From 1ea72011b737524d89ff0f25bfbf85985c73b503 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 21 Feb 2026 19:39:30 +0100 Subject: [PATCH] fix: reduce reconnect backoff to 1s flat Exponential backoff up to 300s made no sense with rotating Tor exits where each reconnect gets a fresh IP. Single 1s delay is sufficient. Co-Authored-By: Claude Opus 4.6 --- docs/CHEATSHEET.md | 2 +- docs/USAGE.md | 12 +++--------- src/bouncer/config.py | 4 ++-- tests/test_config.py | 2 +- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/docs/CHEATSHEET.md b/docs/CHEATSHEET.md index dd3a50a..a09a9c2 100644 --- a/docs/CHEATSHEET.md +++ b/docs/CHEATSHEET.md @@ -156,7 +156,7 @@ SASL EXTERNAL (cert + creds) > SASL PLAIN (creds) > NickServ IDENTIFY ## Reconnect Backoff ``` -5s -> 10s -> 30s -> 60s -> 120s -> 300s (cap) +1s (flat, no escalation) ``` ## PING Watchdog diff --git a/docs/USAGE.md b/docs/USAGE.md index 6d27d60..d1b0201 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -57,14 +57,8 @@ Once probation passes without incident: On any disconnection, the bouncer reconnects with exponential backoff (configurable via `backoff_steps`): -| Attempt | Default Delay | -|---------|---------------| -| 1 | 5s | -| 2 | 10s | -| 3 | 30s | -| 4 | 60s | -| 5 | 120s | -| 6+ | 300s | +Reconnection delay is **1 second** (flat, no escalation). Each attempt gets a +fresh random identity and potentially a different exit IP. Each reconnection uses a fresh random identity. @@ -321,7 +315,7 @@ captcha_poll_timeout = 120 # max seconds to wait for solve # Connection tuning probation_seconds = 45 # post-connect watch period for k-lines -backoff_steps = [5, 10, 30, 60, 120, 300] # reconnect delays +backoff_steps = [1] # reconnect delay (seconds) nick_timeout = 10 # seconds to wait for nick change rejoin_delay = 3 # seconds before rejoin after kick http_timeout = 15 # per-request HTTP timeout diff --git a/src/bouncer/config.py b/src/bouncer/config.py index 043b789..7f85e52 100644 --- a/src/bouncer/config.py +++ b/src/bouncer/config.py @@ -67,7 +67,7 @@ class BouncerConfig: # Connection tuning probation_seconds: int = 45 - backoff_steps: list[int] = field(default_factory=lambda: [5, 10, 30, 60, 120, 300]) + backoff_steps: list[int] = field(default_factory=lambda: [1]) nick_timeout: int = 10 rejoin_delay: int = 3 http_timeout: int = 15 @@ -128,7 +128,7 @@ def load(path: Path) -> Config: captcha_poll_interval=bouncer_raw.get("captcha_poll_interval", 3), captcha_poll_timeout=bouncer_raw.get("captcha_poll_timeout", 120), probation_seconds=bouncer_raw.get("probation_seconds", 45), - backoff_steps=bouncer_raw.get("backoff_steps", [5, 10, 30, 60, 120, 300]), + backoff_steps=bouncer_raw.get("backoff_steps", [1]), nick_timeout=bouncer_raw.get("nick_timeout", 10), rejoin_delay=bouncer_raw.get("rejoin_delay", 3), http_timeout=bouncer_raw.get("http_timeout", 15), diff --git a/tests/test_config.py b/tests/test_config.py index 6d20fce..a652596 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -151,7 +151,7 @@ channel_keys = { "#secret" = "hunter2" } cfg = load(_write_config(MINIMAL_CONFIG)) b = cfg.bouncer assert b.probation_seconds == 45 - assert b.backoff_steps == [5, 10, 30, 60, 120, 300] + assert b.backoff_steps == [1] assert b.nick_timeout == 10 assert b.rejoin_delay == 3 assert b.http_timeout == 15