MCPcopy Create free account
hub / github.com/experdot/pointer / flush

Function flush

src/renderer/src/stores/persistenceQueue.ts:111–142  ·  view source on GitHub ↗
(key: TKey)

Source from the content-addressed store, hash-verified

109 }
110
111 async function flush(key: TKey): Promise<void> {
112 const timer = timers.get(key)
113 if (timer) {
114 clearTimeout(timer)
115 timers.delete(key)
116 }
117
118 const inflight = writing.get(key)
119 if (inflight) {
120 await inflight
121 }
122
123 const task = pending.get(key)
124 if (!task) return
125
126 pending.delete(key)
127 firstQueueTime.delete(key)
128
129 const writePromise = retryWithBackoff(
130 () => persistFn(key, task.data),
131 maxRetries,
132 initialRetryDelay,
133 `persist ${key}`
134 )
135
136 writing.set(key, writePromise)
137 try {
138 await writePromise
139 } finally {
140 writing.delete(key)
141 }
142 }
143
144 async function flushAll(): Promise<void> {
145 const keys = Array.from(pending.keys())

Callers 2

enqueueFunction · 0.85
flushAllFunction · 0.85

Calls 3

retryWithBackoffFunction · 0.85
getMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected