I'm trying to schedule daily Quartz jobs at the same time on certain days of the week, e.g. 9am every Tuesday or 10am on Tuesdays and Wednesdays.
Quartz's firing times are unexpected when the weekday matches the weekday of today's date. Triggers fire at 9am as expected except when today's weekday matches the schedule day, in which case the trigger fires immediately, e.g. if today is Tuesday and the trigger is for Tuesday, instead of firing at 9am next week, the trigger will fire now. Why does Quartz do this?
The only way I have found to prevent this behaviour is to override the trigger's starting time to the following day, but then it misses the trigger for the present day if the current time is before the trigger time, which makes it pointless for me to use Quartz as a daily scheduler.
Note: I am using Quartz via Quartzite, a thin Clojure layer over Quartz, but the unexpected behaviour does not seem to be related to Quartzite.
Here is my trigger-building Clojure code:
(t/build
(t/with-identity (t/key "some-unique-id"))
(t/with-schedule (clojurewerkz.quartzite.schedule.daily-interval/schedule
(on-days-of-the-week (TreeSet. (vec (map #(Integer/valueOf %) [3 4])))) ; Tuesday and Wednesday
(starting-daily-at (daily-interval/time-of-day 09 00 00)))))