Skip to content

Hangfire.LiteDB get locked for concurrent accessΒ #23

@vpatil007

Description

@vpatil007

We are having problems with accessing the LiteDB database with Hangfire implementation. We are using Hangfire.LiteDB (0.3.0) and looks like for concurrent multi process environment database is getting locked, which results in crashing the Hangfire jobs. The size of the database is really small (3MB).

We are simply creating the connection and attaching it to the hangfireDB. Following is the connection code,

`public void ConfigureServices(IServiceCollection service)
{
ApiStartupExtensions.ConfigureServices(Configuration, service, _currentHostingEnvironment);

        ApplicationContext context = new ApplicationContext()
        {
            ApplicationConfiguration = Configuration,
        };
        //Register RetryPolicies as Singelton
        service.AddSingleton<RetryPolicies>();
        service.AddHangfire(t => t.UseLiteDbStorage(Configuration.GetConnectionString("HangfireConnection")));            
    }`

Could you share an example of how to implement concurrency with Hangfire jobs using HangFire.LiteDB or You can suggest a necessary changes required?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions