Hi Team,
We are replacing our use of ServiceStack.Quartz with Background Jobs. We have some long running tasks that are scheduled to run every 15 minutes. The Command can at times run for more than 15 minutes. In the event that a Command runs for 45 minutes, we don’t want multiple Commands to queue up. Is there an already supported way of doing this? What I have tried so far
- Have a Command that is executed as a callback after the long running Command that deletes any queued Commands for that same instance from the DB.
- Use the OnSuccess and OnFailed callbacks on the BackgroundJobOptions.
No 1. seems to work but I’d prefer if there was an option on the BackgroundJobOptions or a version of RecurringCommand that would do this for me.
No 2. doesn’t work and so I wondering if these callbacks are ever called when the calling RecurringCommand. My code is as follows:
jobs.RecurringCommand<Jobby>(Schedule.Interval(TimeSpan.FromSeconds(1)), options: new BackgroundJobOptions
{
Worker = "single",
OnSuccess = o =>
{
var a = 1;
},
OnFailed = o =>
{
var b = 1;
}
});