mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
fix(gateway): resolve zombie connection hangs on gateway drops and reconnect opcodes
- Handle opcodes 7 (Reconnect) and 9 (InvalidSession) by terminating sockets and clearing session state for clean re-IDENTIFY - Update gateway heartbeat timestamp exclusively on genuine Dispatch (op 0) and Heartbeat ACK (op 11) - Trigger proactive shard reconnect immediately on raw WebSocket close events - Tighten gateway watchdog intervals and add a hard-kill timeout on gracefulShutdown to prevent process hangs - Allow child bot processes to control the Docker container health file - Add guildId/guild getters on Message wrapper for robust command routing
This commit is contained in:
1 parent
1251d8a53f
commit
36ad89b1d2
5 files changed
+157
-21
No files matched your search
@@ -132,9 +132,11 @@ manager.on("error", (err) => {
|
||||
const healthFile = path.join(os.tmpdir(), ".remix-health");
|
||||
const updateHealth = () => {
|
||||
try {
|
||||
/* Only touch healthFile during supervisor boot before child shards are spawned.
|
||||
* Once child processes exist, Bot.mjs in the child controls the heartbeat based on gateway health. */
|
||||
if (manager.shards && manager.shards.size > 0) {
|
||||
const anyAlive = [...manager.shards.values()].some(s => s.process && !s.process.killed);
|
||||
if (!anyAlive) return;
|
||||
if (anyAlive) return;
|
||||
}
|
||||
fs.writeFile(healthFile, Date.now().toString(), () => {});
|
||||
} catch (_) {}
|
||||
|
||||
Reference in new issue
Block a user