namespace Duempelkas.Infrastructure.Services; internal sealed class DatabaseLease(SemaphoreSlim? gate) : IDisposable { public static async Task AcquireAsync(DatabaseLocation? location) { if (location != null) await location.Writes.WaitAsync(); return new DatabaseLease(location?.Writes); } public void Dispose() => gate?.Release(); }