fix(bot): revert qrTimeout — keep Baileys' native 60/20s rotation

The earlier "QR refreshes every 5 s" bug was the session-manager
auto-reconnect loop (commit 4d10c72), not the QR cadence. Baileys'
default QR rotation (60 s first ref, then ~20 s per subsequent ref) is
the correct native behaviour — each rotation just refreshes the
displayed QR via SSE. Forcing qrTimeout=60s suppressed those legitimate
rotations and made the QR feel stuck.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
yiekheng 2026-05-10 08:58:35 +08:00
parent 234e8aa690
commit 65f4d2d099

View File

@ -46,11 +46,11 @@ export async function startSession(params: {
auth: state,
browser: Browsers.macOS("Safari"),
syncFullHistory: false,
// Default: 60 s for the first QR, 20 s for subsequent ones (~5 refs ≈
// 2.5 min total before Baileys gives up). Set both legs to 60 s so
// the operator has the full ~5 min pairing window to scan, matching
// pair-handler's PAIR_TIMEOUT_MS.
qrTimeout: 60_000,
// Use Baileys' default QR cadence (60 s for the first ref, ~20 s for
// each subsequent ref) — that's the native WhatsApp Web cadence and
// each rotation just refreshes the displayed QR. The earlier "QR
// refresh every 5 s" bug was the session-manager reconnect loop,
// not the cadence.
logger: logger.child({ accountId, component: "baileys" }) as never,
});