Преглед изворни кода

Add comments in CqlStorage

Olivier Coanet пре 3 година
родитељ
комит
09fe755b33
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      src/Abc.Zebus.Persistence.Cassandra/Cql/CqlStorage.cs

+ 5 - 0
src/Abc.Zebus.Persistence.Cassandra/Cql/CqlStorage.cs

@@ -86,7 +86,12 @@ namespace Abc.Zebus.Persistence.Cassandra.Cql
             }
 
             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));