mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
hotfix
This commit is contained in:
1 parent
dc238213c5
commit
506d3c4cf8
7 files changed
+107
-277
No files matched your search
+22
-1
@@ -519,7 +519,12 @@ export class PlayerManager {
|
||||
}
|
||||
// Also check if a join is in-progress for this channel
|
||||
if (this._pendingJoins.has(cleanUserChannelId)) {
|
||||
return null; // A player is being created — caller should retry
|
||||
const pendingPlayer = await this._waitForPendingJoin(cleanUserChannelId);
|
||||
if (pendingPlayer) {
|
||||
pendingPlayer.textChannel = message.channel;
|
||||
return pendingPlayer;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,6 +597,22 @@ export class PlayerManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
async _waitForPendingJoin(channelId, timeoutMs = 5_000) {
|
||||
const cleanChannelId = cleanId(channelId);
|
||||
const startedAt = Date.now();
|
||||
|
||||
while (this._pendingJoins.has(cleanChannelId) && (Date.now() - startedAt) < timeoutMs) {
|
||||
const player = this.playerMap.get(cleanChannelId)
|
||||
?? [...this.playerMap.values()].find((entry) => getPlayerChannelId(entry) === cleanChannelId);
|
||||
if (player) return player;
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
}
|
||||
|
||||
return this.playerMap.get(cleanChannelId)
|
||||
?? [...this.playerMap.values()].find((entry) => getPlayerChannelId(entry) === cleanChannelId)
|
||||
?? null;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
// Channel Selection Prompt
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in new issue
Block a user