Fixed excessively high CPU load

This commit is contained in:
Pax1601
2023-12-13 22:06:51 +01:00
parent a52e7e7b1a
commit 378dbfc085
4 changed files with 4 additions and 2 deletions

View File

@@ -88,7 +88,7 @@ extern "C" DllExport int coreFrame(lua_State* L)
frameCounter++;
const std::chrono::duration<double> executionDuration = std::chrono::system_clock::now() - lastExecution;
if (executionDuration.count() > FRAMERATE_TIME_INTERVAL) {
if (executionDuration.count() > (20 * FRAMERATE_TIME_INTERVAL)) {
if (executionDuration.count() > 0) {
scheduler->setFrameRate(frameCounter / executionDuration.count());
frameCounter = 0;

View File

@@ -330,7 +330,7 @@ void Server::task()
.then([&listener]() {log("RESTServer starting to listen"); })
.wait();
while (runListener);
while (runListener) { Sleep(1000); };
listener.close()
.then([&listener]() {log("RESTServer stopping connections"); })