()
| 309 | // the previous one settles. A long-polling server may hold each request for |
| 310 | // many seconds, so a fixed interval would stack overlapping requests. |
| 311 | const scheduleReconnect = () => { |
| 312 | if (settled) return; |
| 313 | pollTimer = setTimeout(() => { |
| 314 | pollTimer = null; |
| 315 | void runPoll(); |
| 316 | }, input.pollMs ?? OAUTH_AWAIT_DEFAULT_POLL_MS); |
| 317 | }; |
| 318 | const runPoll = async () => { |
| 319 | if (settled) return; |
| 320 | await poll(); |