Skip to content

Commit 0bd56da

Browse files
authored
Core/Misc: Add configuration option for setting the update interval of the Who list cache (TrinityCore#30750)
1 parent 0756fb9 commit 0bd56da

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/server/game/World/World.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,18 @@ void World::LoadConfigSettings(bool reload)
14261426
TC_LOG_INFO("server.loading", "VMap data directory is: {}vmaps", m_dataPath);
14271427

14281428
m_int_configs[CONFIG_MAX_WHO] = sConfigMgr->GetIntDefault("MaxWhoListReturns", 49);
1429+
m_int_configs[CONFIG_WHO_LIST_UPDATE_INTERVAL] = sConfigMgr->GetIntDefault("WhoList.Update.Interval", 5);
1430+
if (int32(m_int_configs[CONFIG_WHO_LIST_UPDATE_INTERVAL]) <= 0)
1431+
{
1432+
TC_LOG_ERROR("server.loading", "WhoList.Update.Interval ({}) must be > 0, set to default 5 seconds.", m_int_configs[CONFIG_WHO_LIST_UPDATE_INTERVAL]);
1433+
m_int_configs[CONFIG_WHO_LIST_UPDATE_INTERVAL] = 5;
1434+
}
1435+
if (reload)
1436+
{
1437+
m_timers[WUPDATE_WHO_LIST].SetInterval(m_int_configs[CONFIG_WHO_LIST_UPDATE_INTERVAL] * IN_MILLISECONDS);
1438+
m_timers[WUPDATE_WHO_LIST].Reset();
1439+
}
1440+
14291441
m_bool_configs[CONFIG_START_ALL_SPELLS] = sConfigMgr->GetBoolDefault("PlayerStart.AllSpells", false);
14301442
m_int_configs[CONFIG_HONOR_AFTER_DUEL] = sConfigMgr->GetIntDefault("HonorPointsAfterDuel", 0);
14311443
m_bool_configs[CONFIG_RESET_DUEL_COOLDOWNS] = sConfigMgr->GetBoolDefault("ResetDuelCooldowns", false);
@@ -2144,7 +2156,7 @@ void World::SetInitialWorldSettings()
21442156

21452157
m_timers[WUPDATE_CHECK_FILECHANGES].SetInterval(500);
21462158

2147-
m_timers[WUPDATE_WHO_LIST].SetInterval(5 * IN_MILLISECONDS); // update who list cache every 5 seconds
2159+
m_timers[WUPDATE_WHO_LIST].SetInterval(getIntConfig(CONFIG_WHO_LIST_UPDATE_INTERVAL) * IN_MILLISECONDS); // update who list cache every 5 seconds
21482160

21492161
m_timers[WUPDATE_CHANNEL_SAVE].SetInterval(getIntConfig(CONFIG_PRESERVE_CUSTOM_CHANNEL_INTERVAL) * MINUTE * IN_MILLISECONDS);
21502162

src/server/game/World/World.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ enum WorldIntConfigs : uint32
324324
CONFIG_ARENA_START_PERSONAL_RATING,
325325
CONFIG_ARENA_START_MATCHMAKER_RATING,
326326
CONFIG_MAX_WHO,
327+
CONFIG_WHO_LIST_UPDATE_INTERVAL,
327328
CONFIG_HONOR_AFTER_DUEL,
328329
CONFIG_PVP_TOKEN_MAP_TYPE,
329330
CONFIG_PVP_TOKEN_ID,

src/server/worldserver/worldserver.conf.dist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,13 @@ ArenaTeam.CharterCost.5v5 = 2000000
715715

716716
MaxWhoListReturns = 49
717717

718+
#
719+
# WhoList.Update.Interval
720+
# Description: Interval in seconds for Who List to get updated
721+
# Default: 5 (seconds)
722+
723+
WhoList.Update.Interval = 5
724+
718725
#
719726
# CharacterCreating.Disabled
720727
# Description: Disable character creation for players based on faction.

0 commit comments

Comments
 (0)