mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[10970] Implement mass mail send infrastructure.
It expected to be used in 2 case: some gameevent must send mails at start/end,
and this can be useful in game commands. Both case wil implemented in later commits.
* New MassMailMgr can accept tasks for send mass mails in safe way for map update threads context/etc.
* It work in way:
- By provided race mask or more generic SQL query string in async query selected affected characters
- At query result ready at next world tick update in safe common part of tick code some from mails
from queued mas mail tasks send.
- Amount mails limited MassMailer.SendPerTick confir option (10 by default). This done for prevent
high server load/lags at send too many mails in one tick (mail send all existed characters in DB
who match to seelction criteria)
- Manager not persistant for server shutdowns so any not send mails in queue lost at shutdown.
But with default setting 10K mail send in 20 secs (10000/50/10). Adding more safe execution
for this case will make related code lot more slow and req. many DB tables and code support.
This commit is contained in:
parent
231c6d77ce
commit
5f2aef756a
13 changed files with 331 additions and 2 deletions
|
|
@ -42,6 +42,7 @@
|
|||
#include "SpellMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "DBCStores.h"
|
||||
#include "MassMailMgr.h"
|
||||
#include "LootMgr.h"
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
#include "MapManager.h"
|
||||
|
|
@ -618,6 +619,8 @@ void World::LoadConfigSettings(bool reload)
|
|||
|
||||
setConfig(CONFIG_UINT32_MAIL_DELIVERY_DELAY, "MailDeliveryDelay", HOUR);
|
||||
|
||||
setConfigMin(CONFIG_UINT32_MASS_MAILER_SEND_PER_TICK, "MassMailer.SendPerTick", 10, 1);
|
||||
|
||||
setConfigPos(CONFIG_UINT32_UPTIME_UPDATE, "UpdateUptimeInterval", 10);
|
||||
if (reload)
|
||||
{
|
||||
|
|
@ -1404,6 +1407,9 @@ void World::Update(uint32 diff)
|
|||
///- Update the game time and check for shutdown time
|
||||
_UpdateGameTime();
|
||||
|
||||
///-Update mass mailer tasks if any
|
||||
sMassMailMgr.Update();
|
||||
|
||||
/// Handle daily quests reset time
|
||||
if (m_gameTime > m_NextDailyQuestReset)
|
||||
ResetDailyQuests();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue