mlockett42 / litedb-async

This library allows the use of asynchronous programming techniques with the LiteDb library
Apache License 2.0
104 stars 13 forks source link

Running under load, LiteRepositoryAsync keeping file lock after Disposing #26

Closed Pete-PlaytimeSolutions closed 1 year ago

Pete-PlaytimeSolutions commented 1 year ago

When running under load , after disposing of the ILiteRepositoryAsync, the UnderlyingDatabase is still holding onto a File lock. I think, due to not immediately disposing of the UnderlyingDatabase too.

This was my simple fix, around line 337 of LiteRepositoryAsync.cs

protected virtual void Dispose(bool disposing)
{
       if (disposing)
       {
            // BUGFIX: Ensure UnderlyingDatabase is immediately disposed of..._
            _db.UnderlyingDatabase.Dispose();
            _db.Dispose();
       }
}
mlockett42 commented 1 year ago

This fix has been added and uploaded as v0.1.5