Skip to content

Commit

Permalink
Merge branch 'main' into importer
Browse files Browse the repository at this point in the history
  • Loading branch information
Scooletz committed Oct 23, 2024
2 parents 2422dcd + 27b440a commit 77db268
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Paprika/Chain/Blockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,13 @@ private async Task FlusherTask()

_flusherQueueCount.Set(readerCount);

// commit but no flush here, it's too heavy, the flush will come later
await batch.Commit(CommitOptions.FlushDataOnly);
var noMoreBlocksToApply = readerCount == 0;

// Commit, but flush only if there's nothing more to apply.
// If there are more blocks, leave it to the external _db.Flush() called outside of this loop.
await batch.Commit(noMoreBlocksToApply
? CommitOptions.FlushDataOnly
: CommitOptions.DangerNoFlush);

// inform blocks about flushing
lock (_blockLock)
Expand Down

0 comments on commit 77db268

Please sign in to comment.