(
mode: RestartMode,
opts: RestartOpts = {},
)
| 276 | } |
| 277 | |
| 278 | async function restartFreebuffSession( |
| 279 | mode: RestartMode, |
| 280 | opts: RestartOpts = {}, |
| 281 | ): Promise<void> { |
| 282 | if (!IS_FREEBUFF) return |
| 283 | // Halt the running poll loop before we touch local stores or DELETE the |
| 284 | // slot. Otherwise an in-flight GET could land mid-reset and overwrite |
| 285 | // state, or the next scheduled tick could fire between DELETE and |
| 286 | // restart() with stale assumptions. restart() re-aborts and re-arms |
| 287 | // below; the extra abort here is cheap. |
| 288 | controller?.abort() |
| 289 | if (opts.resetChat) await resetChatStore() |
| 290 | if (opts.releaseSlot) await releaseFreebuffSlot() |
| 291 | await controller?.restart(mode) |
| 292 | } |
| 293 | |
| 294 | /** |
| 295 | * Re-POST to the server (rejoining the queue / rotating the instance id). |
no test coverage detected