From 3f91e03c75fd6f3ae40a82555dc29a7c490eff10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Tue, 5 Mar 2024 09:31:18 +0100 Subject: [PATCH] WIP --- nano/node/blockprocessor.cpp | 1 + nano/node/fair_queue.hpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/nano/node/blockprocessor.cpp b/nano/node/blockprocessor.cpp index ed6d7b9e12..4f05ab6e37 100644 --- a/nano/node/blockprocessor.cpp +++ b/nano/node/blockprocessor.cpp @@ -51,6 +51,7 @@ nano::block_processor::block_processor (nano::node & node_a, nano::write_databas switch (origin.source) { case nano::block_source::live: + debug_assert (origin.channel != nullptr); // Live blocks should always be associated with a channel return 128; default: return 1024 * 16; diff --git a/nano/node/fair_queue.hpp b/nano/node/fair_queue.hpp index 5bab741dea..11e3d445f6 100644 --- a/nano/node/fair_queue.hpp +++ b/nano/node/fair_queue.hpp @@ -110,13 +110,15 @@ class fair_queue final } /// Should be called periodically to clean up stale channels - void periodic_cleanup (std::chrono::milliseconds interval = std::chrono::milliseconds{ 1000 * 30 }) + bool periodic_cleanup (std::chrono::milliseconds interval = std::chrono::milliseconds{ 1000 * 30 }) { if (elapsed (last_cleanup, interval)) { last_cleanup = std::chrono::steady_clock::now (); cleanup (); + return true; // Cleaned up } + return false; // Not cleaned up } bool push (Request request, Source source, std::shared_ptr channel = nullptr)