mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-01 20:42:50 +08:00
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:
1 parent
eb92b04e11
commit
d0d2f57066
1 file changed
+5
-6
+5
-6
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user