From 63d798a46dd038d1a26c2444b7f40e7afd994077 Mon Sep 17 00:00:00 2001 From: Jean Aurambault Date: Thu, 20 Jul 2023 14:42:07 -0700 Subject: [PATCH] Make the dynamic jobs "recoverable" so they are automatically restarted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently none of the dynamic jobs are marked as “recoverable” hence in case of a Quartz scheduler failure/restart, they won’t be automatically retried. In the case of a server crash or hard shutdown (some deployment) since the job are not restarted, the related PollableTaks will eventually be detected as a zombie when their TTL is reached and will then be marked as failed. This PR is exploratory, it might be better to set it at the job level and let only well idem potent job use it. --- .../box/l10n/mojito/quartz/QuartzPollableTaskScheduler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webapp/src/main/java/com/box/l10n/mojito/quartz/QuartzPollableTaskScheduler.java b/webapp/src/main/java/com/box/l10n/mojito/quartz/QuartzPollableTaskScheduler.java index f036d5c186..6d1bbe85b5 100644 --- a/webapp/src/main/java/com/box/l10n/mojito/quartz/QuartzPollableTaskScheduler.java +++ b/webapp/src/main/java/com/box/l10n/mojito/quartz/QuartzPollableTaskScheduler.java @@ -104,7 +104,11 @@ public PollableFuture scheduleJob(QuartzJobInfo quartzJobInfo) { if (jobDetail == null) { logger.debug("Job doesn't exist, create for key: {}", keyName); jobDetail = - JobBuilder.newJob().ofType(quartzJobInfo.getClazz()).withIdentity(jobKey).build(); + JobBuilder.newJob() + .ofType(quartzJobInfo.getClazz()) + .withIdentity(jobKey) + .requestRecovery() + .build(); } logger.debug("Schedule a job for key: {}", keyName);