jobshangfireabp-framework

What the first one means in hangfire recurringjobs?


In Hangfire Recurring Jobs:

HangfirePeriodicBackgroundWorkerAdapter<BackgroundJobWorker>.DoWorkAsync

What the first one means? Can I delete it?

It seems to be executed every five seconds? Will it consume too much resources?

Thanks very match!


Solution

  • https://i.sstatic.net/jZJDv.png

    This task is added by the AbpBackgroundWorkersHangfireModule module, from the ConfigureServices method.

        public override void ConfigureServices(ServiceConfigurationContext context)
        {
          context.Services.AddSingleton(typeof(HangfirePeriodicBackgroundWorkerAdapter<>));
        }
    

    To disable this task, write this code in your module:

        public override Task OnPostApplicationInitializationAsync(ApplicationInitializationContext context)
        {
            // NAME = RecurringJobId
            const string NAME = "HangfirePeriodicBackgroundWorkerAdapter<BackgroundJobWorker>.DoWorkAsync";
            RecurringJob.RemoveIfExists(NAME);
    
            return base.OnPostApplicationInitializationAsync(context);
        }