fix: sync config with db only after connection is established (#2346)
All checks were successful
Build / build (push) Successful in 57s
Build Docker image / docker-amd64 (push) Successful in 46s
Build Docker image / docker-arm64 (push) Successful in 1m0s

The error message had regressed in the case where connection could not be established.

Reviewed-on: #2346
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
Sainan 2025-06-28 15:08:36 -07:00 committed by Sainan
parent 58bdb2d2ec
commit 00cea6788e

View File

@ -28,12 +28,13 @@ import { updateWorldStateCollections } from "./services/worldStateService";
JSON.stringify = JSONStringify; JSON.stringify = JSONStringify;
validateConfig(); validateConfig();
syncConfigWithDatabase();
mongoose mongoose
.connect(config.mongodbUrl) .connect(config.mongodbUrl)
.then(() => { .then(() => {
logger.info("Connected to MongoDB"); logger.info("Connected to MongoDB");
syncConfigWithDatabase();
startWebServer(); startWebServer();
void updateWorldStateCollections(); void updateWorldStateCollections();