wmedvede commented on code in PR #2214:
URL: 
https://github.com/apache/incubator-kie-kogito-apps/pull/2214#discussion_r2094153342


##########
jobs-service/jobs-service-common/src/main/java/org/kie/kogito/jobs/service/scheduler/JobSchedulerManager.java:
##########
@@ -183,25 +182,30 @@ void loadJobDetails() {
 
     public void doLoadJobDetails(ZonedDateTime fromFireTime, ZonedDateTime 
toFireTime, final int retries) {
         LOGGER.info("Loading jobs to schedule from the repository, 
fromFireTime: {} toFireTime: {}.", fromFireTime, toFireTime);
-        loadJobsBetweenDates(fromFireTime, toFireTime)
-                .filter(this::isNotScheduled)
-                .flatMapRsPublisher(jobDetails -> 
ErrorHandling.skipErrorPublisher((jd) -> scheduler.internalSchedule(jd, 
initialLoading.get()), jobDetails))
-                .forEach(jobDetails -> LOGGER.debug("Loaded and scheduled job 
{}.", jobDetails))
-                .run()
-                .whenComplete((unused, throwable) -> {
-                    if (throwable != null) {
-                        LOGGER.error(String.format("Error during jobs loading, 
retries left: %d.", retries), throwable);
-                        if (retries > 0) {
-                            LOGGER.info("Jobs loading retry: #{} will be 
executed.", retries - 1);
-                            doLoadJobDetails(fromFireTime, toFireTime, retries 
- 1);
-                        } else {
-                            LOGGER.error("Jobs loading has failed and no more 
retires are left, loadJobErrorStrategy: {} will be applied.", 
loadJobErrorStrategy);
-                            applyLoadJobsErrorStrategy(throwable);
-                        }
-                    }
-                    initialLoading.set(false);
-                    LOGGER.info("Loading scheduled jobs completed !");
-                });
+        List<JobDetails> jobsDetails = loadJobsBetweenDates(fromFireTime, 
toFireTime);

Review Comment:
   The JobSchedulerManager manager must also catch a potential exception thrown 
by the loadJobsBetweenDates query 
   and retry as long we have retries left. 
   
   Currently the loadJobsBetweenDates is shadowing potential exceptions. See 
PostgreSqlJobRepository



-- 
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.

To unsubscribe, e-mail: [email protected]

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to