NehanPathan commented on code in PR #1182:
URL: https://github.com/apache/lucenenet/pull/1182#discussion_r2338305683


##########
src/Lucene.Net.Replicator/ReplicationClient.cs:
##########
@@ -468,6 +695,25 @@ public virtual void UpdateNow()
             }
         }
 
+        /// <summary>
+        /// Executes the update operation asynchronously immediately, 
regardless if an update thread is running or not.
+        /// </summary>
+        public virtual async Task UpdateNowAsync(CancellationToken 
cancellationToken = default)
+        {
+            EnsureOpen();
+
+            // Acquire the same update lock to prevent concurrent updates
+            updateLock.Lock();

Review Comment:
   Yes, my bad — I was just trying to stay aligned with the sync version at 
that time.
   
   But after looking more carefully, I think we don’t actually need 
ReentrantLock for the sync version either. From what I see, inside doUpdate or 
doUpdateAsync there aren’t any reentrant scenarios, so it should be safe to use 
SemaphoreSlim in both cases.
   
   @NightOwl888  @paulirwin 
   Please correct me if I’m missing something or if there are still chances of 
reentrancy in the sync version.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to