From 30fddcc5a0433b05ad53d9f773cab815ce88cd2a Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Sat, 29 Mar 2025 14:56:32 -0500 Subject: [PATCH] [Performance] Reduce UpdateWho S2S Chatter to World (#4792) * [Performance] Reduce UpdateWho S2S chatter * Add rule to change this dynamically --- common/ruletypes.h | 1 + zone/main.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 99370f63d..c38f8d593 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -379,6 +379,7 @@ RULE_BOOL(Zone, StateSaveEntityVariables, true, "Set to true if you want buffs t RULE_BOOL(Zone, StateSaveBuffs, true, "Set to true if you want buffs to be saved on shutdown") RULE_INT(Zone, StateSaveClearDays, 7, "Clears state save data older than this many days") RULE_BOOL(Zone, StateSavingOnShutdown, true, "Set to true if you want zones to save state on shutdown (npcs, corpses, loot, entity variables, buffs etc.)") +RULE_INT(Zone, UpdateWhoTimer, 120, "Seconds between updates to /who list, CLE stale timer") RULE_CATEGORY_END() RULE_CATEGORY(Map) diff --git a/zone/main.cpp b/zone/main.cpp index 9e50ea0bd..0474951c8 100644 --- a/zone/main.cpp +++ b/zone/main.cpp @@ -500,6 +500,8 @@ int main(int argc, char **argv) } Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect + Timer UpdateWhoTimer(RuleI(Zone, UpdateWhoTimer) * 1000); // updates who list every 2 minutes + #ifdef EQPROFILE #ifdef PROFILE_DUMP_TIME Timer profile_dump_timer(PROFILE_DUMP_TIME * 1000); @@ -647,7 +649,10 @@ int main(int argc, char **argv) InterserverTimer.Start(); database.ping(); content_db.ping(); - entity_list.UpdateWho(); + if (UpdateWhoTimer.Check()) { + UpdateWhoTimer.SetTimer(RuleI(Zone, UpdateWhoTimer) * 1000); // in-case it was changed + entity_list.UpdateWho(); + } } };