Skip to content

Commit

Permalink
Add comments in CqlStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
ocoanet committed Sep 26, 2022
1 parent 3ca37c9 commit 09fe755
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Abc.Zebus.Persistence.Cassandra/Cql/CqlStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ public Task Write(IList<MatcherEntry> entriesToPersist)
}

var insertTasks = new List<Task>();

// The SemaphoreSlim is deliberately not disposed here:
// - Disposing the semaphore is only useful to dispose the underlying WaitHandle, which is not used (instantiated) here.
// - Disposing the semaphore would require complex logic: it must be disposed after the insertTask continuations to avoid ObjectDisposedException.
var remaining = new SemaphoreSlim(_maxParallelInsertTasks);

foreach (var matcherEntry in entriesToPersist)
{
var gotSlot = remaining.Wait(TimeSpan.FromSeconds(10));
Expand Down

0 comments on commit 09fe755

Please sign in to comment.