November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
From the documentation
"When the application restarts, the jobs that are marked as restartable will be executed immediately if the <see cref="ScheduledJob.LastExecutionAttempt"/> has not exceeded the <see cref="Scheduler.SchedulerOptions.MaximumExecutionAttempts"/>."
Probably that's something you should look into?
MaximumExecutionAttempts is default to 10, and LastExecutionAttempt should be saved to database - look into tblScheduledItem and you should see it
Quan that looks like a quote but no search engine is show me where that text is, and the documentation page I've got doesn't mention those values either..
https://world.episerver.com/documentation/developer-guides/CMS/scheduled-jobs/
have you got a direct link for me please to that documentation?
Thanks Quan,
Ok, so if ScheduledJob.LastExecutionAttempt is an integer count, and Scheduler.SchedulerOptions.MaximumExecutionAttempts is the upper limit allowed....
how do I set those values? ScheduledPlugInAttribute does not allow them to be set and my job extends ScheduledJobBase which doesn't allow them to be set either. Feel like I'm being a bit thick and missing something obvious here
I'm not entirely sure, but you might be able to do this
ServiceLocator.Current.GetInstance<SchedulerOptions>().MaximumExecutionAttempts = 100;
LastExecutionAttempt should be reset to 0 after the job is successfully completed
I've noticed the admin panel for my job now has a 'stop' button after a restart...
but my scheduled job still hasn't run, and i know this because the 'Debugger.Launch()
' code in my Execute()
method isn't getting hit.
So it kinda thinks it should be running but I see no evidence of it running
Hi Noel,
Have you implemented a way to actually stop the job and reset things ready for another run? In the back of my mind I'm sure I remember reading that a job must be stoppable in order to also be restartable... could be wrong though, and maybe you already do this?
Hi James,
Actually I think thats why the "stop job" button appearred that i screenshot'ed above. At first i was hoping it meant it was running, but now i think it's because episerver knows the job is now stoppable. Yeah I've written everything to allow insert or update, and then i store my progress in the DDS, and have a job editors can use to restart the job is anything goes wrong.
I think the problem was in my logic somewhere, initially was hoping someone would tell me my setup was wrong, but just my logic instead :-( lol
Having taken some advice from a previous forum post, I'm using 'Debugger.Launch' like so...
..to attach to my scheduled job whenever it is run. I presume I'm using the correct attribute to create a restartable scheduled job...
but my job isn't restarting when I...
a. ...kill the IIS Worker Process
b. ...recycle the app pool
c. ...set the app pool idle timeout to 2 minutes
If I then call my job directly, its happy to start work and pick up from where it left off, so it appears it's just episerver not asking for it to start again after it stops
How do I simulate a correct restartable situation?