diff options
| author | Andrew <47818697+Nyeriah@users.noreply.github.com> | 2025-10-01 07:16:32 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-01 07:16:32 -0300 |
| commit | dbd4aaf0655ac2742e7fc6c08bd688fd8d4edef8 (patch) | |
| tree | ba9fc54bfcaf16878e2258d1e21e2b68a2c351f6 | |
| parent | a0a8187ea468d26b0ce800157ebd526b50ab4141 (diff) | |
feat(Core/Updater): Add configurable shutdown delay on update exceptions (#23042)
| -rw-r--r-- | src/server/apps/worldserver/worldserver.conf.dist | 8 | ||||
| -rw-r--r-- | src/server/database/Updater/DBUpdater.cpp | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/server/apps/worldserver/worldserver.conf.dist b/src/server/apps/worldserver/worldserver.conf.dist index 8f54e0dd0e..89863ac4f9 100644 --- a/src/server/apps/worldserver/worldserver.conf.dist +++ b/src/server/apps/worldserver/worldserver.conf.dist @@ -344,6 +344,14 @@ Updates.AllowRehash = 1 Updates.CleanDeadRefMaxCount = 3 # +# Updates.ExceptionShutdownDelay +# Description: Time (in milliseconds) to wait before shutting down after a fatal exception (e.g. failed SQL update). +# Default: 10000 - 10 seconds +# 0 - Disabled (immediate shutdown) + +Updates.ExceptionShutdownDelay = 10000 + +# ################################################################################################### ################################################################################################### diff --git a/src/server/database/Updater/DBUpdater.cpp b/src/server/database/Updater/DBUpdater.cpp index eecce68a12..442b48bcb8 100644 --- a/src/server/database/Updater/DBUpdater.cpp +++ b/src/server/database/Updater/DBUpdater.cpp @@ -518,7 +518,12 @@ void DBUpdater<T>::ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& hos path.generic_string(), pool.GetConnectionInfo()->database); if (!sConfigMgr->isDryRun()) + { + if (uint32 delay = sConfigMgr->GetOption<uint32>("Updates.ExceptionShutdownDelay", 10000)) + std::this_thread::sleep_for(Milliseconds(delay)); + throw UpdateException("update failed"); + } } } |
