Possible fix for event handler timeouts

This commit is contained in:
Lion Kortlepel 2021-11-29 02:56:41 +01:00
parent ccdc5dae17
commit 98c7fea139
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B
2 changed files with 6 additions and 4 deletions

View File

@ -149,8 +149,7 @@ void TConsole::Command_Help(const std::string&) {
kick <name> [reason] kicks specified player with an optional reason kick <name> [reason] kicks specified player with an optional reason
list lists all players and info about them list lists all players and info about them
say <message> sends the message to all players in chat say <message> sends the message to all players in chat
lua [state id] switches to lua, optionally into a specific state id's lua lua [state id] switches to lua, optionally into a specific state id's lua)";
)";
Application::Console().WriteRaw("BeamMP-Server Console: " + std::string(sHelpString)); Application::Console().WriteRaw("BeamMP-Server Console: " + std::string(sHelpString));
} }

View File

@ -61,8 +61,11 @@ void TLuaEngine::operator()() {
while (!Res->Ready) { while (!Res->Ready) {
std::this_thread::sleep_for(std::chrono::milliseconds(1)); std::this_thread::sleep_for(std::chrono::milliseconds(1));
Waited++; Waited++;
if (Waited > 1000) { if (Waited > 250) {
beammp_lua_error(Res->Function + " in " + Res->StateId + " took >1s to respond, not printing possible errors"); // FIXME: This should *eventually* timeout.
// beammp_lua_error(Res->Function + " in " + Res->StateId + " took >1s to respond, not printing possible errors");
std::unique_lock Lock(mResultsToCheckMutex);
mResultsToCheck.push(Res);
break; break;
} }
} }