diff --git a/common/events/player_event_logs.cpp b/common/events/player_event_logs.cpp index cbae34536..c3c64a4c2 100644 --- a/common/events/player_event_logs.cpp +++ b/common/events/player_event_logs.cpp @@ -139,6 +139,10 @@ void PlayerEventLogs::AddToQueue(const PlayerEventLogsRepository::PlayerEventLog m_batch_queue_lock.lock(); m_record_batch_queue.emplace_back(log); m_batch_queue_lock.unlock(); + + if (m_record_batch_queue.size() >= RuleI(Logging, BatchPlayerEventProcessChunkSize)) { + ProcessBatchQueue(); + } } // fills common event data in the SendEvent function diff --git a/common/ruletypes.h b/common/ruletypes.h index 547ac345e..efcc0fd36 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -783,6 +783,7 @@ RULE_BOOL(Logging, PrintFileFunctionAndLine, false, "Ex: [World Server] [net.cpp RULE_BOOL(Logging, WorldGMSayLogging, true, "Relay worldserver logging to zone processes via GM say output") RULE_BOOL(Logging, PlayerEventsQSProcess, false, "Have query server process player events instead of world. Useful when wanting to use a dedicated server and database for processing player events on separate disk") RULE_INT(Logging, BatchPlayerEventProcessIntervalSeconds, 5, "This is the interval in which player events are processed in world or qs") +RULE_INT(Logging, BatchPlayerEventProcessChunkSize, 10000, "This is the cap of events that can be inserted into the queue before a force flush. This is to keep from hitting MySQL max_allowed_packet and killing the connection") RULE_CATEGORY_END() RULE_CATEGORY(HotReload)