fix(backup): use active SQLite database and validate safe restore (U01)
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
namespace Duempelkas.Infrastructure.Services;
|
||||
|
||||
internal sealed class DatabaseLease(SemaphoreSlim? gate) : IDisposable
|
||||
{
|
||||
public static async Task<DatabaseLease> AcquireAsync(DatabaseLocation? location)
|
||||
{
|
||||
if (location != null) await location.Writes.WaitAsync();
|
||||
return new DatabaseLease(location?.Writes);
|
||||
}
|
||||
|
||||
public void Dispose() => gate?.Release();
|
||||
}
|
||||
Reference in New Issue
Block a user