MCPcopy Index your code
hub / github.com/coder/mux / enqueueWrite

Method enqueueWrite

src/node/services/devToolsService.ts:567–573  ·  view source on GitHub ↗

* Serialize all disk writes per workspace so clear() and appendToFile() * can never complete out of order.

(workspaceId: string, fn: () => Promise<void>)

Source from the content-addressed store, hash-verified

565 * can never complete out of order.
566 */
567 private enqueueWrite(workspaceId: string, fn: () => Promise<void>): Promise<void> {
568 const prev = this.writeQueues.get(workspaceId) ?? Promise.resolve();
569 // Always chain regardless of prior failure so the queue never stalls.
570 const next = prev.then(fn, () => fn());
571 this.writeQueues.set(workspaceId, next);
572 return next;
573 }
574
575 private async appendToFile(workspaceId: string, entry: DevToolsLogEntry): Promise<void> {
576 return this.enqueueWrite(workspaceId, async () => {

Callers 2

clearMethod · 0.95
appendToFileMethod · 0.95

Calls 3

resolveMethod · 0.80
setMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected