Skip to content

Commit b1bb138

Browse files
committed
Fixes issue with re-index lock provider
Addresses an issue where the re-index lock provider was not correctly awaiting the enqueue operation. This change ensures that the work item is properly enqueued before releasing the lock.
1 parent 0733bcb commit b1bb138

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Foundatio.Repositories.Elasticsearch/Configuration/ElasticConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading;
@@ -157,7 +157,7 @@ private async Task ConfigureIndexInternalAsync(IIndex idx, bool beginReindexingO
157157

158158
// enqueue reindex to new version, only allowed every 15 minutes
159159
string enqueueReindexLockName = String.Join(":", "enqueue-reindex", reindexWorkItem.Alias, reindexWorkItem.OldIndex, reindexWorkItem.NewIndex);
160-
await _beginReindexLockProvider.TryUsingAsync(enqueueReindexLockName, () => _workItemQueue.EnqueueAsync(reindexWorkItem), TimeSpan.Zero, new CancellationToken(true)).AnyContext();
160+
await _beginReindexLockProvider.TryUsingAsync(enqueueReindexLockName, async () => { await _workItemQueue.EnqueueAsync(reindexWorkItem).AnyContext(); }, TimeSpan.Zero, new CancellationToken(true)).AnyContext();
161161
}
162162

163163
public Task MaintainIndexesAsync(IEnumerable<IIndex> indexes = null)

0 commit comments

Comments
 (0)