fix: 自动连接改为非阻塞并行 — 一个bot连接失败不影响其他bot

之前 loadSavedBots 用 await 顺序连接所有bot,一个超时会阻塞
后续所有bot和web server启动。改为 .then()/.catch() 并行连接,
每个bot独立成败互不影响。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
saopig1andClaude Opus 4.6 committed 2026-03-30 21:33:32 +08:00
1 parent eb92b04e11
commit d0d2f57066
1 file changed
+5 -6
+5 -6
View File
@@ -163,19 +163,18 @@ export class BotManager {
this.bots.set(saved.id, bot);
// Auto-connect all saved bots on startup
try {
await bot.connect();
// Auto-connect in background (non-blocking, won't affect other bots)
bot.connect().then(() => {
this.logger.info(
{ botId: saved.id, name: saved.name },
"Auto-connected saved bot"
);
} catch (err) {
}).catch((err) => {
this.logger.error(
{ err, botId: saved.id, name: saved.name },
"Failed to auto-connect bot (will retry on manual start)"
"Failed to auto-connect bot (start manually from Settings)"
);
}
});
}
this.logger.info(