Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LiteDB log file persists after program close #30

Open
dylanstreb opened this issue Feb 11, 2022 · 2 comments
Open

LiteDB log file persists after program close #30

dylanstreb opened this issue Feb 11, 2022 · 2 comments

Comments

@dylanstreb
Copy link

Litedb 5 now creates a dbname-log.db file. Hangfire.LiteDB appears to not properly clean up litedb resources, so the log file persists after program termination. I suspect some Dispose call is getting lost at some point. From trying to open the actual db in LiteDB Studio, it looks like the content is never written to the real db, only to the forward log.

This occurs with the console app in the samples folder, as a quick demo of the issue.

@ruslan-mogilevskiy
Copy link

ruslan-mogilevskiy commented Aug 17, 2022

That's not a problem of this library. LiteDB's Checkpoint method needs to be called manually, possibly with some schedule or so depending on your application needs.

@bkempinski
Copy link

bkempinski commented Jun 27, 2023

Workaround:

        services.AddHangfire((services, options) =>
        {
            var lifetime = services.GetRequiredService<IHostApplicationLifetime>();
            var liteDb = options.UseLiteDbStorage(jobsDbName, storageOptions.Value);

            lifetime.ApplicationStopping.Register(() => liteDb.Entry.Connection.Database.Dispose());
        });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants