fix: sync config with db only after connection is established #2346

Merged
Sainan merged 1 commits from db-sync-fix into main 2025-06-28 15:08:36 -07:00
Showing only changes of commit e92f238f7d - Show all commits

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();