From 3fb0c923363159b7964b05b01d4e7551dc292593 Mon Sep 17 00:00:00 2001 From: "efrat@ravendb.net" Date: Wed, 20 Dec 2023 16:27:37 +0200 Subject: [PATCH] RavenDB-21802 Should_Delete_All_Documents_Without_Timeout fix --- .../Documents/BulkInsert/BulkInsertOperation.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Raven.Client/Documents/BulkInsert/BulkInsertOperation.cs b/src/Raven.Client/Documents/BulkInsert/BulkInsertOperation.cs index 00e278343b16..b1c04a054705 100644 --- a/src/Raven.Client/Documents/BulkInsert/BulkInsertOperation.cs +++ b/src/Raven.Client/Documents/BulkInsert/BulkInsertOperation.cs @@ -317,14 +317,14 @@ private static void HandleHeartbeat(object state) private async Task SendHeartBeatAsync() { - try - { - if (DateTime.UtcNow.Ticks - _lastWriteToStream.Ticks < _heartbeatCheckInterval.Ticks) - return; + if (DateTime.UtcNow.Ticks - _lastWriteToStream.Ticks < _heartbeatCheckInterval.Ticks) + return; - if (_streamLock.Wait(0) == false) - return; // if locked we are already writing + if (_streamLock.Wait(0) == false) + return; // if locked we are already writing + try + { await ExecuteBeforeStore().ConfigureAwait(false); EndPreviousCommandIfNeeded(); _options.ForTestingPurposes?.OnSendHeartBeat_DoBulkStore?.Invoke();