First implementation for the conversation system (not 100% finished yet)

This commit is contained in:
WolverinDEV
2019-07-19 22:55:03 +02:00
parent dd0eaf33e5
commit e507d1f75d
20 changed files with 1545 additions and 44 deletions
+16 -3
View File
@@ -4,6 +4,7 @@
#include <log/LogUtils.h>
#include "InstanceHandler.h"
#include "TSServer.h"
#include "./manager/ConversationManager.h"
using namespace std;
using namespace std::chrono;
@@ -52,7 +53,7 @@ void TSServer::executeServerTick() {
lastTick = system_clock::now();
system_clock::time_point timing_begin, timing_end;
milliseconds timing_update_states, timing_client_tick, timing_channel, timing_statistic, timing_groups;
milliseconds timing_update_states, timing_client_tick, timing_channel, timing_statistic, timing_groups, timing_ccache;
auto client_list = this->getClients();
@@ -255,14 +256,26 @@ void TSServer::executeServerTick() {
END_TIMINGS(timing_groups);
}
{
BEGIN_TIMINGS();
if(this->conversation_cache_cleanup_timestamp + minutes(15) < system_clock::now()) {
debugMessage(this->serverId, "Cleaning up conversation cache.");
this->_conversation_manager->cleanup_cache();
conversation_cache_cleanup_timestamp = system_clock::now();
}
END_TIMINGS(timing_ccache);
}
if(system_clock::now() - lastTick > milliseconds(100)) {
//milliseconds timing_update_states, timing_client_tick, timing_channel, timing_statistic;
logError(this->serverId, "Server tick tooks to long ({}ms => Status updates: {}ms Client tick: {}ms, Channel tick: {}ms, Statistic tick: {}ms)",
logError(this->serverId, "Server tick tooks to long ({}ms => Status updates: {}ms Client tick: {}ms, Channel tick: {}ms, Statistic tick: {}ms, Groups: {}ms, Conversation cache: {}ms)",
duration_cast<milliseconds>(system_clock::now() - lastTick).count(),
timing_update_states.count(),
timing_client_tick.count(),
timing_channel.count(),
timing_statistic.count()
timing_statistic.count(),
timing_groups.count(),
timing_ccache.count()
);
}
} catch (std::exception& ex) {