From c3ab12467b71cb55af24c32e9ae11a0f7266e5f4 Mon Sep 17 00:00:00 2001 From: Mustafa Omerovic Date: Wed, 26 Apr 2023 10:54:59 +0200 Subject: [PATCH] Fix for issue: https://github.com/mbdavid/LiteDB/issues/2307 Remove if queue empty check that does not reset running flag. If the queue was already emptied out already by the previous ExecuteQueue, then this way it will always reset running flag back to 0. --- LiteDB/Engine/Disk/DiskWriterQueue.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/LiteDB/Engine/Disk/DiskWriterQueue.cs b/LiteDB/Engine/Disk/DiskWriterQueue.cs index a7d2a443f..0592cc6b9 100644 --- a/LiteDB/Engine/Disk/DiskWriterQueue.cs +++ b/LiteDB/Engine/Disk/DiskWriterQueue.cs @@ -1,12 +1,7 @@ using System; using System.Collections.Concurrent; -using System.Collections.Generic; -using System.ComponentModel; using System.IO; using System.Linq; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using static LiteDB.Constants; @@ -24,7 +19,7 @@ internal class DiskWriterQueue : IDisposable // async thread controls private Task _task; - private ConcurrentQueue _queue = new ConcurrentQueue(); + private readonly ConcurrentQueue _queue = new ConcurrentQueue(); private int _running = 0; @@ -92,8 +87,6 @@ public void Wait() /// private void ExecuteQueue() { - if (_queue.Count == 0) return; - do { if (_queue.TryDequeue(out var page))