MCPcopy Create free account
hub / github.com/TanStack/db / getOrCreateContext

Method getOrCreateContext

packages/db/src/scheduler.ts:56–70  ·  view source on GitHub ↗

* Get or create the state bucket for a context.

(
    contextId: SchedulerContextId,
  )

Source from the content-addressed store, hash-verified

54 * Get or create the state bucket for a context.
55 */
56 private getOrCreateContext(
57 contextId: SchedulerContextId,
58 ): SchedulerContextState {
59 let context = this.contexts.get(contextId)
60 if (!context) {
61 context = {
62 queue: [],
63 jobs: new Map(),
64 dependencies: new Map(),
65 completed: new Set(),
66 }
67 this.contexts.set(contextId, context)
68 }
69 return context
70 }
71
72 /**
73 * Schedule work. Without a context id, executes immediately.

Callers 1

scheduleMethod · 0.95

Calls 2

getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected