From b3e3c6503d3c92a3487afe5a3145568b691fd411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ku=CC=88nzer?= Date: Tue, 25 Feb 2020 11:32:09 +0100 Subject: [PATCH] Fix problem with faulty triggers in waiting_triggers --- .../joelinn/quartz/jobstore/AbstractRedisStorage.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java b/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java index acb75ff..9f10653 100644 --- a/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java +++ b/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java @@ -817,6 +817,15 @@ public List acquireNextTriggers(long noLaterThan, int maxCount, } for (Tuple triggerTuple : jedis.zrangeByScoreWithScores(redisSchema.triggerStateKey(RedisTriggerState.WAITING), 0, (double) (noLaterThan + timeWindow), 0, maxCount)) { OperableTrigger trigger = retrieveTrigger(redisSchema.triggerKey(triggerTuple.getElement()), jedis); + + // Trigger data of a waiting trigger not found -> clean up + if (trigger == null) { + jedis.zrem(redisSchema.triggerStateKey(RedisTriggerState.WAITING), triggerTuple.getElement()); + jedis.srem(redisSchema.triggersSet(), triggerTuple.getElement()); + jedis.del(redisSchema.triggerDataMapHashKey(redisSchema.triggerKey(triggerTuple.getElement()))); + continue; + } + if(applyMisfire(trigger, jedis)){ if (logger.isDebugEnabled()) { logger.debug("misfired trigger: " + triggerTuple.getElement());