I have tasks that have to be run automatically one by one by calling webapi interface. However , when I use below code to add multiple jobs in the same queue in a very short interval and then check them out in the dashboard , I check every job in the same queue,the status are the same which is processing ,doesn’t work one by one as expected . And after a while ,the status changed to succeed .However ,all my tasks doesn’t completed noramally. Can anyone give me some advice ?
BackgroundJob.Enqueue(() => MyTask(inputParm));
public class Startup
{
public void Configuration(IAppBuilder app)
{
GlobalConfiguration.Configuration.UseSqlServerStorage("HangFireConnectionStr");
var Dashboardoptions = new DashboardOptions
{
Authorization = new[] { new hangfireAuthorization() }
};
app.UseHangfireDashboard("/hangfire", Dashboardoptions);
var Options= new BackgroundJobServerOptions
{
Queues = new[] { "cnv","snv","mito", "recurring", "default" },
WorkerCount = Environment.ProcessorCount * 2
};
app.UseHangfireServer(Options);