giladw commented on a change in pull request #260:
URL: https://github.com/apache/unomi/pull/260#discussion_r591627705



##########
File path: 
services/src/main/java/org/apache/unomi/services/impl/segments/SegmentServiceImpl.java
##########
@@ -839,20 +839,25 @@ private void 
updateExistingProfilesForPastEventCondition(Condition eventConditio
 
         String propertyKey = (String) 
parentCondition.getParameter("generatedPropertyKey");
 
+        int updatedProfileCount = 0;
         if(pastEventsDisablePartitions) {
             Map<String, Long> eventCountByProfile = 
persistenceService.aggregateWithOptimizedQuery(eventCondition, new 
TermsAggregate("profileId"), Event.ITEM_TYPE, maximumIdsQueryCount);
-            updateProfilesWithPastEventProperty(eventCountByProfile, 
propertyKey);
+            updatedProfileCount = 
updateProfilesWithPastEventProperty(eventCountByProfile, propertyKey);
         } else {
             Map<String, Double> m = 
persistenceService.getSingleValuesMetrics(andCondition, new String[]{"card"}, 
"profileId.keyword", Event.ITEM_TYPE);
             long card = m.get("_card").longValue();
             int numParts = (int) (card / aggregateQueryBucketSize) + 2;
             for (int i = 0; i < numParts; i++) {
                 Map<String, Long> eventCountByProfile = 
persistenceService.aggregateWithOptimizedQuery(andCondition, new 
TermsAggregate("profileId", i, numParts), Event.ITEM_TYPE);
-                updateProfilesWithPastEventProperty(eventCountByProfile, 
propertyKey);
+                updatedProfileCount += 
updateProfilesWithPastEventProperty(eventCountByProfile, propertyKey);
             }
         }
 
-        logger.info("Profiles past condition updated in {}ms", 
System.currentTimeMillis() - t);
+        if (forceRefresh && updatedProfileCount > 0) {

Review comment:
       just to make sure, 
   if the update is done with bulkProcessor, how do you know that the refresh 
happened after the bulk processor has finished?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to