You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by jk...@apache.org on 2023/05/02 09:50:50 UTC

[unomi] branch fixSegmentJobScheduling updated: UNOMI-761: Correctly calculate initial delay of the Segment/Scoring recalculation scheduled task

This is an automated email from the ASF dual-hosted git repository.

jkevan pushed a commit to branch fixSegmentJobScheduling
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/fixSegmentJobScheduling by this push:
     new d08ce39d3 UNOMI-761: Correctly calculate initial delay of the Segment/Scoring recalculation scheduled task
d08ce39d3 is described below

commit d08ce39d3f6d4c9520d1412b333bdc240d13588f
Author: Kevan <ke...@jahia.com>
AuthorDate: Tue May 2 11:50:36 2023 +0200

    UNOMI-761: Correctly calculate initial delay of the Segment/Scoring recalculation scheduled task
---
 .../org/apache/unomi/services/impl/segments/SegmentServiceImpl.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/services/src/main/java/org/apache/unomi/services/impl/segments/SegmentServiceImpl.java b/services/src/main/java/org/apache/unomi/services/impl/segments/SegmentServiceImpl.java
index 7e8147544..0aac270c6 100644
--- a/services/src/main/java/org/apache/unomi/services/impl/segments/SegmentServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/impl/segments/SegmentServiceImpl.java
@@ -1216,8 +1216,10 @@ public class SegmentServiceImpl extends AbstractServiceImpl implements SegmentSe
             }
         };
         long initialDelay = SchedulerServiceImpl.getTimeDiffInSeconds(dailyDateExprEvaluationHourUtc, ZonedDateTime.now(ZoneOffset.UTC));
-        logger.info("daily recalculation job for segments and scoring that contains date relative conditions will run at fixed rate, initialDelay={}, taskExecutionPeriod={}", initialDelay, TimeUnit.DAYS.toSeconds(1));
-        schedulerService.getScheduleExecutorService().scheduleAtFixedRate(task, initialDelay, taskExecutionPeriod * 24 * 60 * 60, TimeUnit.SECONDS);
+        long period = TimeUnit.DAYS.toSeconds(taskExecutionPeriod);
+        logger.info("daily recalculation job for segments and scoring that contains date relative conditions will run at fixed rate, " +
+                "initialDelay={}, taskExecutionPeriod={} in seconds", initialDelay, period);
+        schedulerService.getScheduleExecutorService().scheduleAtFixedRate(task, initialDelay, period, TimeUnit.SECONDS);
 
         task = new TimerTask() {
             @Override