mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
fix: enhance connection state checks in Player and Helpers247 modules
This commit is contained in:
1 parent
cc91e602fc
commit
7c7d94b3fb
3 files changed
+13
-8
No files matched your search
@@ -41,7 +41,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- mysql_data:/var/lib/mysql
|
- mysql_data:/var/lib/mysql
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-remix_root_pw}"]
|
test: ["CMD-SHELL", "MYSQL_PWD=${MYSQL_ROOT_PASSWORD:-remix_root_pw} mysqladmin ping -h 127.0.0.1 -u root"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
|
|||||||
@@ -560,7 +560,8 @@ class Player extends EventEmitter {
|
|||||||
const check = () => {
|
const check = () => {
|
||||||
try {
|
try {
|
||||||
if (voiceConn.isConnected()) { clearTimeout(timeout); return resolve(); }
|
if (voiceConn.isConnected()) { clearTimeout(timeout); return resolve(); }
|
||||||
if (voiceConn.connectionState === 0) { clearTimeout(timeout); return resolve(); }
|
const cs = voiceConn.connectionState;
|
||||||
|
if (cs === 2 || cs === "connected" || cs === "CONN_CONNECTED") { clearTimeout(timeout); return resolve(); }
|
||||||
} catch (_) { clearTimeout(timeout); return resolve(); }
|
} catch (_) { clearTimeout(timeout); return resolve(); }
|
||||||
setTimeout(check, 200);
|
setTimeout(check, 200);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,14 +25,18 @@ export function isPlayerConnectionDead(player) {
|
|||||||
const conn = player._voiceConn ?? player.connection ?? null;
|
const conn = player._voiceConn ?? player.connection ?? null;
|
||||||
if (!conn) return true;
|
if (!conn) return true;
|
||||||
|
|
||||||
const room = conn.room ?? null;
|
if (typeof conn.isConnected === "function") {
|
||||||
if (!room) {
|
try {
|
||||||
try { return conn.isConnected?.() === false; } catch (_) { return false; }
|
if (!conn.isConnected()) return true;
|
||||||
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
if (room.isConnected === false) return true;
|
|
||||||
|
|
||||||
const cs = room.connectionState;
|
const room = conn.room ?? null;
|
||||||
if (cs === 0 || cs === "CONN_DISCONNECTED") return true;
|
if (room) {
|
||||||
|
if (room.isConnected === false || room.isClosed === true) return true;
|
||||||
|
const cs = (room.state ?? room.connectionState ?? "").toString().toLowerCase();
|
||||||
|
if (cs === "disconnected" || cs === "0" || cs === "conn_disconnected") return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user