diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index cbcf60d35..74c6244a8 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -177,7 +177,7 @@ int main() } if (player_event_process_timer.Check()) { - std::jthread player_event_thread(&PlayerEventLogs::Process, &player_event_logs); + player_event_logs.Process(); } }; diff --git a/world/main.cpp b/world/main.cpp index 93bb3a9a4..df69f6122 100644 --- a/world/main.cpp +++ b/world/main.cpp @@ -381,11 +381,19 @@ int main(int argc, char **argv) } ); - Timer player_event_process_timer(1000); if (player_event_logs.LoadDatabaseConnection()) { player_event_logs.Init(); } + auto event_log_processor = std::jthread([](const std::stop_token& stoken) { + while (!stoken.stop_requested()) { + if (!RuleB(Logging, PlayerEventsQSProcess)) { + player_event_logs.Process(); + } + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + } + }); + auto loop_fn = [&](EQ::Timer* t) { Timer::SetCurrentTime(); @@ -448,10 +456,6 @@ int main(int argc, char **argv) } } - if (player_event_process_timer.Check()) { - std::jthread event_thread(&PlayerEventLogs::Process, &player_event_logs); - } - if (PurgeInstanceTimer.Check()) { database.PurgeExpiredInstances(); database.PurgeAllDeletedDataBuckets(); @@ -502,6 +506,8 @@ int main(int argc, char **argv) EQ::EventLoop::Get().Run(); + event_log_processor.request_stop(); + LogInfo("World main loop completed"); LogInfo("Shutting down zone connections (if any)"); zoneserver_list.KillAll();