[Crash] Fix Rarer World Crash with Player Event Thread Processor (#4800)

* [Crash] Fix Rarer World Crash with Player Event thread processor

* Update main.cpp
This commit is contained in:
Chris Miles 2025-03-29 14:26:00 -05:00 committed by GitHub
parent 6d69ac7a98
commit 46511365a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 6 deletions

View File

@ -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();
}
};

View File

@ -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();