Opens voice reconnect backoff.
From 9c1a2f70e2b4c8d1e3f5a6b7c8d9e0f1a2b3c4d5 Mon Sep 17 00:00:00 2001
From: Jamie Rivers <jamie@example.net>
Date: Tue, 2 Dec 2026 11:04:22 -0800
Subject: [PATCH] gateway: reconnect voice sockets with backoff
When the relay drops, clients currently reconnect in a tight loop.
Add exponential backoff so a flapping relay can't stampede.
---
src/gateway/voice.ts | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/gateway/voice.ts b/src/gateway/voice.ts
--- a/src/gateway/voice.ts
+++ b/src/gateway/voice.ts
@@ -112,8 +112,13 @@ export class VoiceSocket {
private onClose() {
- this.reconnect();
+ const delay = Math.min(1000 * 2 ** this.attempts++, 30_000);
+ setTimeout(() => this.reconnect(), delay);
}
- private reconnect() {
+ private reconnect() {
+ this.attempts = 0;
this.open();
}