mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[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:
parent
6d69ac7a98
commit
46511365a7
@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user