MCPcopy Create free account
hub / github.com/electric-sql/electric / createInFlightTracker

Function createInFlightTracker

packages/agents-runtime/src/process-wake.ts:407–432  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

405}
406
407function createInFlightTracker() {
408 let count = 0
409 let resolve: (() => void) | null = null
410
411 return {
412 track<T>(promise: Promise<T>): Promise<T> {
413 count++
414 return promise.finally(() => {
415 count--
416 if (count === 0 && resolve) {
417 resolve()
418 resolve = null
419 }
420 })
421 },
422 async drain(): Promise<void> {
423 if (count === 0) return
424 return new Promise<void>((r) => {
425 resolve = r
426 })
427 },
428 get pending() {
429 return count
430 },
431 }
432}
433
434export async function processWake(
435 notification: WebhookNotification,

Callers 1

processWakeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected