I have IO intensive method that i am running as background job using hangfire.
public IHttpActionResult Request(int[] ids)
{
foreach(var id in ids)
{
BackgroundJob.Enqueue<IMyService>(x => x.DoWork(id));
}
}
So for each id i Enqueue a background job and hangfire immediately invoke DoWork()
as expected. However DoWork
is IO intensive. So if i have 100+ ids it takes lot of CPU power and bandwidth
Is there anyway to throttle number of background jobs in Hangfire