@On causes Job to run twice
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
play framework |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
There is a bug in the Jobs mechanism that causes jobs annotated with @On to sometimes run twice. This is causing emails in an application I have to be sent twice.
When the Job has finished running, the _finally method is invoked:
@Override
public void _finally() {
if (executor == JobsPlugin.
}
}
This results in a call to scheduleForCRON(), which schedules the next invocation of the job by working out the difference in time between now and when it should next run using Time.parseCRONE
A problem occurs if Time.parseCRONE
For example, the job is scheduled to run at 4:00am. ScheduledThread
One solution would be to make sure that the variable delay is not less than one second:
public static <V> void scheduleForCRON
if (job.getClass(
String cron = job.getClass(
if (cron.startsWit
}
if (cron != null && !cron.equals("")) {
try {
} catch (Exception ex) {
}
} else {
}
}
}
An example of some logs from my server:
23:59:56,519 INFO ~ Sent rating emails from 7 days ago to 1 users.
23:59:56,519 INFO ~ Automatic sending of rating emails is enabled.
00:00:00,032 INFO ~ Sent rating emails from 7 days ago to 1 users.
00:00:00,032 INFO ~ Automatic sending of rating emails is enabled.