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

Method withWorkspaceLifecycleLock

src/node/services/taskService.ts:6016–6027  ·  view source on GitHub ↗
(
    resolved: ResolvedWorkspaceLifecycleTarget,
    operation: (lockedResolved: ResolvedWorkspaceLifecycleTarget) => Promise<T>
  )

Source from the content-addressed store, hash-verified

6014 }
6015
6016 private async withWorkspaceLifecycleLock<T>(
6017 resolved: ResolvedWorkspaceLifecycleTarget,
6018 operation: (lockedResolved: ResolvedWorkspaceLifecycleTarget) => Promise<T>
6019 ): Promise<T> {
6020 return await this.workspaceLifecycleLocks.withLock(resolved.workspaceId, async () => {
6021 const lockedResolved = {
6022 ...resolved,
6023 metadata: await this.findWorkspaceLifecycleMetadata(resolved.workspaceId),
6024 };
6025 return await operation(lockedResolved);
6026 });
6027 }
6028
6029 private async resolveOwnedWorkspaceLifecycleTarget(
6030 ownerWorkspaceId: string,

Calls 2

withLockMethod · 0.80

Tested by

no test coverage detected