From f8c9c4f5e333232b4e1d87d5c38bb1480c44bccc Mon Sep 17 00:00:00 2001 From: abereznikov Date: Tue, 12 Mar 2024 19:22:11 +0500 Subject: [PATCH] Don't capture synchronization context in DiskWriterQueue --- LiteDB/Engine/Disk/DiskWriterQueue.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LiteDB/Engine/Disk/DiskWriterQueue.cs b/LiteDB/Engine/Disk/DiskWriterQueue.cs index d86474a2b..f9e388c72 100644 --- a/LiteDB/Engine/Disk/DiskWriterQueue.cs +++ b/LiteDB/Engine/Disk/DiskWriterQueue.cs @@ -58,7 +58,7 @@ public void EnqueuePage(PageBuffer page) if (_task == null) { - _task = Task.Factory.StartNew(ExecuteQueue, TaskCreationOptions.LongRunning); + _task = Task.Factory.StartNew(ExecuteQueue, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default); } } } @@ -100,7 +100,7 @@ private async Task ExecuteQueue() _stream.FlushToDisk(); - await _queueHasItems.WaitAsync(); + await _queueHasItems.WaitAsync().ConfigureAwait(false); } } }