Hi everyone,
I’m testing a scheduled job (test_generateIssue) that runs a service with a 10-minute sleep to simulate long processing. The job starts correctly:
18:35:58.166 INFO ... Running job test_generateIssue run M125706
18:35:58.199 INFO ... Service run started, and going to sleep for 10 minutes...
But on every subsequent scheduler tick, Moqui tries to pick the same job again, even though it’s still running. This results in repeated messages like:
18:36:58.174 INFO ... Lock found for job test_generateIssue ... not running
18:37:58.164 INFO ... Lock found for job test_generateIssue ... not running
18:38:58.163 INFO ... Lock found for job test_generateIssue ... not running
...
18:44:58.196 INFO ... Lock found for job test_generateIssue ... not running
The job itself runs fine, but these logs are unnecessary and pollute the output.
Observation
It seems Moqui checks the run lock first, and only afterwards checks the cron expression to decide if the job should run.
Wouldn’t it be better if the scheduler:
- Checked the cron trigger first, to see if the job is due to run,
- And only then checked the run lock?
This would prevent repeated “lock found” logs for long-running jobs that aren’t actually scheduled to run again yet.
Is this the intended behavior?
Thanks!