MCPcopy
hub / github.com/coder/mux / clearInMemoryState

Method clearInMemoryState

src/node/services/initStateManager.ts:386–396  ·  view source on GitHub ↗

* Clear in-memory state for a workspace. * Useful for testing or cleanup after workspace deletion. * Does NOT delete disk file (use deleteInitStatus for that). * * Also cancels any running init promises to prevent orphaned waiters.

(workspaceId: string)

Source from the content-addressed store, hash-verified

384 * Also cancels any running init promises to prevent orphaned waiters.
385 */
386 clearInMemoryState(workspaceId: string): void {
387 this.store.deleteState(workspaceId);
388
389 // Cancel any running init promise for this workspace
390 const promiseEntry = this.initPromises.get(workspaceId);
391 if (promiseEntry) {
392 promiseEntry.reject(new Error(`Workspace ${workspaceId} was deleted`));
393 promiseEntry.resolveHookPhase();
394 this.initPromises.delete(workspaceId);
395 }
396 }
397
398 /**
399 * Wait for workspace initialization to complete.

Callers 5

createMethod · 0.80
createMultiProjectMethod · 0.80
removeMethod · 0.80
archiveMethod · 0.80

Calls 3

deleteStateMethod · 0.80
getMethod · 0.65
deleteMethod · 0.45

Tested by

no test coverage detected