MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / restartFreebuffSession

Function restartFreebuffSession

cli/src/hooks/use-freebuff-session.ts:278–292  ·  view source on GitHub ↗
(
  mode: RestartMode,
  opts: RestartOpts = {},
)

Source from the content-addressed store, hash-verified

276}
277
278async 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).

Callers 5

refreshFreebuffSessionFunction · 0.85
returnToFreebuffLandingFunction · 0.85
joinFreebuffQueueFunction · 0.85
takeOverFreebuffSessionFunction · 0.85

Calls 2

resetChatStoreFunction · 0.85
releaseFreebuffSlotFunction · 0.85

Tested by

no test coverage detected