Skip to content

Commit

Permalink
Fix for issue: #2307
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Mustafa Omerovic committed Apr 26, 2023
1 parent 84faf67 commit c3ab124
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions LiteDB/Engine/Disk/DiskWriterQueue.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -24,7 +19,7 @@ internal class DiskWriterQueue : IDisposable
// async thread controls
private Task _task;

private ConcurrentQueue<PageBuffer> _queue = new ConcurrentQueue<PageBuffer>();
private readonly ConcurrentQueue<PageBuffer> _queue = new ConcurrentQueue<PageBuffer>();

private int _running = 0;

Expand Down Expand Up @@ -92,8 +87,6 @@ public void Wait()
/// </summary>
private void ExecuteQueue()
{
if (_queue.Count == 0) return;

do
{
if (_queue.TryDequeue(out var page))
Expand Down

0 comments on commit c3ab124

Please # to comment.