Files
wekan/server/00waitForMongo.js
Lauri Ojansivu 39f3c89b0a Fixed upgrade crash.
Thanks to poc-sm and Claude !

Fixes #6367
2026-06-06 02:53:58 +03:00

17 lines
856 B
JavaScript

import { Meteor } from 'meteor/meteor';
import { waitForMongoReady } from '/server/lib/mongoStartup';
// ============================================================================
// MUST be the first server import (see server/imports.js) so this Meteor.startup
// hook is registered first and therefore runs before any other startup hook
// that creates indexes (server/models/users.js, collectionBootstrap.js, ...).
//
// It blocks startup until MongoDB is reachable with an elected replica-set
// primary, preventing the "An error occurred when creating an index ...
// Topology is closed" crash when WeKan starts before MongoDB is ready (common
// right after an upgrade while MongoDB replays its journal).
// ============================================================================
Meteor.startup(async () => {
await waitForMongoReady();
});