MCPcopy Create free account
hub / github.com/anomalyco/opencode / sync

Function sync

packages/app/src/context/server-session.ts:612–624  ·  view source on GitHub ↗
(sessionID: string, options?: { force?: boolean; messageLimit?: number })

Source from the content-addressed store, hash-verified

610 }
611
612 const sync = (sessionID: string, options?: { force?: boolean; messageLimit?: number }) => {
613 touch(sessionID)
614 return runInflight(inflight, sessionID, async () => {
615 const cached = data.message[sessionID] !== undefined && meta.limit[sessionID] !== undefined
616 if (cached && data.info[sessionID] && !options?.force) return
617 await Promise.all([
618 resolve(sessionID, options),
619 cached && !options?.force
620 ? Promise.resolve()
621 : loadMessages(sessionID, options?.messageLimit ?? meta.limit[sessionID] ?? initialMessagePageSize),
622 ])
623 })
624 }
625
626 const prefetch = async (sessionID: string, limit: number) => {
627 touch(sessionID)

Callers

nothing calls this directly

Calls 5

runInflightFunction · 0.85
loadMessagesFunction · 0.85
touchFunction · 0.70
resolveFunction · 0.70
allMethod · 0.45

Tested by

no test coverage detected