Skip to content

Commit

Permalink
Differentiate between node IO runners and general IO
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed May 25, 2024
1 parent 30f2de0 commit 13bfea1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions nano/lib/thread_roles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ std::string nano::thread_role::get_string (nano::thread_role::name role)
case nano::thread_role::name::io:
thread_role_name_string = "I/O";
break;
case nano::thread_role::name::io_daemon:
thread_role_name_string = "I/O (daemon)";
break;
case nano::thread_role::name::work:
thread_role_name_string = "Work pool";
break;
Expand Down
1 change: 1 addition & 0 deletions nano/lib/thread_roles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ enum class name
{
unknown,
io,
io_daemon,
work,
message_processing,
vote_processing,
Expand Down
2 changes: 1 addition & 1 deletion nano/nano_node/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void nano::daemon::run (std::filesystem::path const & data_path, nano::node_flag
logger.info (nano::log::type::daemon, "Start time: {:%c} UTC", fmt::gmtime (dateTime));

// IO context runner should be started first and stopped last to allow asio handlers to execute during node start/stop
runner = std::make_unique<nano::thread_runner> (io_ctx, logger, node->config.io_threads);
runner = std::make_unique<nano::thread_runner> (io_ctx, logger, node->config.io_threads, nano::thread_role::name::io_daemon);

node->start ();

Expand Down
2 changes: 1 addition & 1 deletion nano/nano_rpc/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void run (std::filesystem::path const & data_path, std::vector<std::string> cons

std::shared_ptr<boost::asio::io_context> io_ctx = std::make_shared<boost::asio::io_context> ();

runner = std::make_unique<nano::thread_runner> (io_ctx, logger, rpc_config.rpc_process.io_threads);
runner = std::make_unique<nano::thread_runner> (io_ctx, logger, rpc_config.rpc_process.io_threads, nano::thread_role::name::io_daemon);

try
{
Expand Down
2 changes: 1 addition & 1 deletion nano/nano_wallet/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ int run_wallet (QApplication & application, int argc, char * const * argv, std::

std::shared_ptr<boost::asio::io_context> io_ctx = std::make_shared<boost::asio::io_context> ();

nano::thread_runner runner (io_ctx, logger, config.node.io_threads);
nano::thread_runner runner (io_ctx, logger, config.node.io_threads, nano::thread_role::name::io_daemon);

std::shared_ptr<nano::node> node;
std::shared_ptr<nano_qt::wallet> gui;
Expand Down

0 comments on commit 13bfea1

Please sign in to comment.