codeyu / Hangfire.LiteDB

LiteDB storage for Hangfire.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Job in "enqueue" when using custom BackgroundJobServerOptions.

sicay1 opened this issue · comments

I love to liteDB for hangfire for my small project. I found a problem if i use custom BackgroundJobServerOptions, background job will stuck at "enqueue" forever.

my setup in Startup.cs like this:

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }

            app.UseStaticFiles();
            
            app.UseHangfireServer(new BackgroundJobServerOptions()
            {
                Queues = new[] { "queue1111", "DEFAULT" },
                ServerName = "SuperCollector",
                WorkerCount = Environment.ProcessorCount * 2,
                HeartbeatInterval = new TimeSpan(0, 0, 30)
            });
            app.UseHangfireDashboard("/hf", new DashboardOptions
            {
                AppPath = "/",
                DisplayStorageConnectionString = false,
                
            });

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}");
            });
        }

Hi Sica y1, could you share the code in which you call your recurring tasks?

I am currently using Hangfire.LiteDB for a project in production and I have no problems with this.

image

Thanks for help, i fingered i was created multiple BackgroundJobServer, maybe that cause problem.
Here is my test hangfire repo https://github.com/sicay1/CoreHangfire1 (please change using liteDB in startup.cs).

Can you use hangfire console with liteDB??

With version v0.3.0 yes, since there was an error that did not allow using this plugin and others (like https://github.com/raisedapp/Hangfire.JobsLogger).

Wait for @codeyu to publish this version.

v0.3.0 released. thank you @felixclase , @sicay1 .