diff --git a/.pkg b/.pkg index 89a5cce2a..487181922 100644 --- a/.pkg +++ b/.pkg @@ -13,7 +13,7 @@ [utl] url=git@github.com:motis-project/utl.git branch=master - commit=f76f70812be09d88b260e398ddd43fc7345f9fb9 + commit=9c44a5abcb62c0463df87355e0cb29d90906f0d0 [adr] url=git@github.com:triptix-tech/adr.git branch=master diff --git a/.pkg.lock b/.pkg.lock index 8e9e05ced..f95e9794e 100644 --- a/.pkg.lock +++ b/.pkg.lock @@ -1,11 +1,11 @@ -521520066768043934 +14846770624705372750 cista 5b6808fd7d7a7c1c7e4cb152b563dbf71e3efba4 zlib-ng 68ab3e2d80253ec5dc3c83691d9ff70477b32cd3 boost 73549ebca677fe6214202a1ab580362b4f80e653 googletest 7b64fca6ea0833628d6f86255a81424365f7cc0c libressl 24acd9e710fbe842e863572da9d738715fbc74b8 fmt dc10f83be70ac2873d5f8d1ce317596f1fd318a2 -utl f76f70812be09d88b260e398ddd43fc7345f9fb9 +utl 9c44a5abcb62c0463df87355e0cb29d90906f0d0 net 7b089e022471bb5adf716d0c7b0cdb57a23c7adc PEGTL 1c1aa6e650e4d26f10fa398f148ec0cdc5f0808d res b759b93316afeb529b6cb5b2548b24c41e382fb0 diff --git a/src/server.cc b/src/server.cc index ba201e11b..0c54c1120 100644 --- a/src/server.cc +++ b/src/server.cc @@ -1,11 +1,15 @@ #include "boost/asio/io_context.hpp" +#include "fmt/format.h" + #include "net/run.h" #include "net/stop_handler.h" #include "net/web_server/query_router.h" #include "net/web_server/web_server.h" +#include "utl/enumerate.h" #include "utl/init_from.h" +#include "utl/set_thread_name.h" #include "motis/config.h" #include "motis/endpoints/adr/geocode.h" @@ -97,6 +101,7 @@ int server(data d, config const& c) { if (c.requires_rt_timetable_updates()) { rt_update_ioc = std::make_unique(); rt_update_thread = std::make_unique([&]() { + utl::set_current_thread_name("rt update"); run_rt_update(*rt_update_ioc, c, *d.tt_, *d.tags_, d.rt_); rt_update_ioc->run(); }); @@ -107,6 +112,7 @@ int server(data d, config const& c) { if (d.w_ && d.l_ && c.has_gbfs_feeds()) { gbfs_update_ioc = std::make_unique(); gbfs_update_thread = std::make_unique([&]() { + utl::set_current_thread_name("gbfs update"); gbfs::run_gbfs_update(*gbfs_update_ioc, c, *d.w_, *d.l_, d.gbfs_); gbfs_update_ioc->run(); }); @@ -115,8 +121,9 @@ int server(data d, config const& c) { auto const work_guard = asio::make_work_guard(workers); auto threads = std::vector( static_cast(std::max(1U, server_config.n_threads_))); - for (auto& t : threads) { + for (auto [i, t] : utl::enumerate(threads)) { t = std::thread(net::run(workers)); + utl::set_thread_name(t, fmt::format("worker {}", i)); } auto const stop = net::stop_handler(ioc, [&]() {