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); } } }