Episerver Scheduled jobs - Give feedback!
- Part 1: Make it fail!
- Part 2: Give feedback!
- Part 3: Stop and restart!
- Part 4: Add a GUID!
Have you ever wondered what your long-running scheduled job is doing right now? Are you waiting for it to finish, and considering if you have time for a coffee?
Make your jobs give feedback!
It's as easy as calling OnStatusChanged
in ScheduledJobBase
. Quick code example:
[ScheduledPlugIn(DisplayName = "My scheduled job")]
public class MyScheduledJob : ScheduledJobBase
{
public override string Execute()
{
for (var i = 0; i < Items.Count(); i++)
{
FinishItem(Items[i]);
OnStatusChanged(i + " items finished.");
}
return Items.Count() + " items finished successfully.";
}
}
While running the job, it will look like this:
That's it!
Found this post helpful? Help keep this blog ad-free by buying me a coffee! ☕