mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-09 08:18:07 +00:00
standx, ondoperps, lighter and backpack each hand-rolled the same three pieces around their socket: a 'one pending attempt at a time' timer guard, an attempt counter feeding a backoff formula, and resetting that counter on open. Four field-name conventions, four formulas, four places to forget the reset. ReconnectScheduler owns the timer, the guard and the counter; the backoff stays a caller-supplied policy (fixed / linear / exponential), since the venues genuinely want different curves. Verified value-by-value that all four produce the identical delay sequence they did before. Scope was chosen, not maximal. The other five gateways' reconnect paths, and all nine connect/auth/subscribe/heartbeat flows, stay where they are: those are 60-200 lines of per-venue protocol, and folding nine different auth and ping semantics into one base class would be the wrong abstraction. I also checked the reconnect paths for the classic defects — aster's timer that looked unclearable is cleared at the top of connect(), and all three backoff counters do reset on open — so there was no bug to fix here, only duplication. 12 new tests. 287 pass; tsc and oxlint clean.