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());