mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
idk
This commit is contained in:
1 parent
8974fd34df
commit
42011a7e70
1 file changed
+9
-1
@@ -634,6 +634,8 @@ export class Remix {
|
|||||||
const wsManager = this.client?.ws;
|
const wsManager = this.client?.ws;
|
||||||
if (!wsManager) return;
|
if (!wsManager) return;
|
||||||
|
|
||||||
|
let attachedNew = false;
|
||||||
|
|
||||||
const logWsError = (label, err) => {
|
const logWsError = (label, err) => {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
if (now - _wsErrorCooldown.lastLogged < _wsErrorCooldown.COOLDOWN_MS) return;
|
if (now - _wsErrorCooldown.lastLogged < _wsErrorCooldown.COOLDOWN_MS) return;
|
||||||
@@ -645,6 +647,7 @@ export class Remix {
|
|||||||
if (!wsObj) return;
|
if (!wsObj) return;
|
||||||
if (wsObj._fluxerErrorHandled) return;
|
if (wsObj._fluxerErrorHandled) return;
|
||||||
wsObj._fluxerErrorHandled = true;
|
wsObj._fluxerErrorHandled = true;
|
||||||
|
attachedNew = true;
|
||||||
|
|
||||||
if (typeof wsObj.on === "function") {
|
if (typeof wsObj.on === "function") {
|
||||||
wsObj.on("error", (err) => logWsError(label, err));
|
wsObj.on("error", (err) => logWsError(label, err));
|
||||||
@@ -662,6 +665,7 @@ export class Remix {
|
|||||||
if (!shard) return;
|
if (!shard) return;
|
||||||
if (shard._fluxerErrorHandled) return;
|
if (shard._fluxerErrorHandled) return;
|
||||||
shard._fluxerErrorHandled = true;
|
shard._fluxerErrorHandled = true;
|
||||||
|
attachedNew = true;
|
||||||
shard.on("error", (err) => logWsError(`Shard ${id}`, err));
|
shard.on("error", (err) => logWsError(`Shard ${id}`, err));
|
||||||
if (shard.ws) attachToSocket(shard.ws, `Shard ${id} socket`);
|
if (shard.ws) attachToSocket(shard.ws, `Shard ${id} socket`);
|
||||||
};
|
};
|
||||||
@@ -678,6 +682,7 @@ export class Remix {
|
|||||||
|
|
||||||
if (typeof wsManager.on === "function" && !wsManager._fluxerErrorHandled) {
|
if (typeof wsManager.on === "function" && !wsManager._fluxerErrorHandled) {
|
||||||
wsManager._fluxerErrorHandled = true;
|
wsManager._fluxerErrorHandled = true;
|
||||||
|
attachedNew = true;
|
||||||
wsManager.on("error", ({ shardId, error }) => {
|
wsManager.on("error", ({ shardId, error }) => {
|
||||||
logWsError(`WSManager (shard ${shardId})`, error);
|
logWsError(`WSManager (shard ${shardId})`, error);
|
||||||
});
|
});
|
||||||
@@ -685,12 +690,15 @@ export class Remix {
|
|||||||
|
|
||||||
if (typeof wsManager.on === "function" && !wsManager._shardCreateHandled) {
|
if (typeof wsManager.on === "function" && !wsManager._shardCreateHandled) {
|
||||||
wsManager._shardCreateHandled = true;
|
wsManager._shardCreateHandled = true;
|
||||||
|
attachedNew = true;
|
||||||
wsManager.on("shardCreate", (shard) => {
|
wsManager.on("shardCreate", (shard) => {
|
||||||
attachToShard(shard, shard.id ?? "?");
|
attachToShard(shard, shard.id ?? "?");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.player("[WS] Proactive error handlers attached to gateway sockets.");
|
if (attachedNew) {
|
||||||
|
logger.player("[WS] Proactive error handlers attached to gateway sockets.");
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn("[WS] Failed to attach WS error handlers:", e.message);
|
logger.warn("[WS] Failed to attach WS error handlers:", e.message);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user