michaelklishin / quartz-mongodb

A MongoDB-based store for the Quartz scheduler. This fork strives to be as feature complete as possible. Originally by MuleSoft.
Other
249 stars 203 forks source link

Batch Acquire Triggers Breaks #42

Closed lordbuddha closed 10 years ago

lordbuddha commented 10 years ago

The scheduler can be configured to batch acquire triggers:-

"org.quartz.scheduler.batchTriggerAcquisitionMaxCount", "50"

However, this job store breaks badly when this is used. The issue is that the current recursive retry mechanism assumes that batch mode is never used and that only one trigger is to be acquired.

When aquiring multiple triggers, it must not forget the triggers it has already acquired when recursing to retry the acquires that have failed.

So, when recursing, add the result of the recursion to the triggers you already have:-

triggers.addAll(acquireNextTriggers(noLaterThan, maxCount - triggers.size(), timeWindow));

michaelklishin commented 10 years ago

@lordbuddha pull request, please.

michaelklishin commented 10 years ago

Should be fixed in a3917a5651aa419b8fc717b07419eb62c14ff5ba.