Tags: Tidsstyrte jobber

Episerver Scheduled jobs - Give feedback!

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:

En animasjon som viser en tidsstyrt jobb som kjører mens status kontinuerlig oppdateres.

That's it!

Found this post helpful? Help keep this blog ad-free by buying me a coffee! ☕