mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
cleannnn
This commit is contained in:
1 parent
05fb38aabd
commit
bc1fe82919
43 files changed
+122
-1784
No files matched your search
@@ -4,19 +4,11 @@ import { logger } from "../src/constants/Logger.mjs";
|
||||
|
||||
const config = JSON.parse(fs.readFileSync(new URL("../config.json", import.meta.url)));
|
||||
|
||||
// Pass bot ID from config if available, so migrations are bot-isolated.
|
||||
// If no botId in config, all rows are migrated (legacy behavior).
|
||||
const botId = config.botId ?? null;
|
||||
|
||||
// Both source and destination use RemoteSettingsManager to ensure the
|
||||
// `guilds` Map is populated from MySQL. The abstract SettingsManager base
|
||||
// class has no implementation (no guilds, no load, no defaults).
|
||||
const sm = new RemoteSettingsManager(config.mysql, "./storage/defaults.json", botId);
|
||||
const rsm = new RemoteSettingsManager(config.mysql, "./storage/defaults.json", botId);
|
||||
|
||||
// Ensure source manager is fully loaded BEFORE starting migration.
|
||||
// Previously, rsm's "ready" could fire before sm finished loading,
|
||||
// resulting in an empty servers array and a silent no-op migration.
|
||||
let migrationStarted = false;
|
||||
|
||||
sm.on("ready", async () => {
|
||||
@@ -25,7 +17,6 @@ sm.on("ready", async () => {
|
||||
|
||||
const servers = [...sm.guilds.entries()];
|
||||
|
||||
// Wait for the destination manager to be ready too
|
||||
if (!rsm.guilds.size) {
|
||||
await new Promise(resolve => rsm.on("ready", resolve));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user