You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a few classes that extend relax.BatchableProcessStep and are created through JobScheduler.CreateOneTimeJob() with a start time of Datetime.now().addMinutes(-5).
After a few minutes, the job kicks off, and I can see through the dev console that it's running.
However, I find that one minute after the batch has started, the same batch class has been spawned again with the exact same parameters. Sometimes it's 1 extra copy, other times it's 2 extras.
There's no error taking place in the batch classes (I've surrounded them with try/catch), and the complete() method is being used at all exit points.
Attaching two files:
Listing of Apex Jobs, see "UpdateItemStatusBatch":
Output from the jobs that has been sent into Slack. Exactly the same output from the batch running twice.
I looked through the code, and wonder if this is what's happening:
Job kicks off and spawns the batch
In the meantime, the job scheduler runs again and sees that the job is still "Queued" (I've never seen it have a status other than "Queued" or "Completed"), that the next run time is before now and runs it again.
By the time the job scheduler runs again, both instances have been completed.
So...
Is there a reason why the job status never gets updated?
I have a few classes that extend relax.BatchableProcessStep and are created through JobScheduler.CreateOneTimeJob() with a start time of Datetime.now().addMinutes(-5).
After a few minutes, the job kicks off, and I can see through the dev console that it's running.
However, I find that one minute after the batch has started, the same batch class has been spawned again with the exact same parameters. Sometimes it's 1 extra copy, other times it's 2 extras.
There's no error taking place in the batch classes (I've surrounded them with try/catch), and the complete() method is being used at all exit points.
Attaching two files:
I looked through the code, and wonder if this is what's happening:
So...
FWIW, I tried setting up the code on my own sandbox, but ran into a ton of errors while deploying it. Else I would have tried to fix it myself.
The text was updated successfully, but these errors were encountered: