wishforge-ide/apps/ide/provisioner/run-operations.mjs
eust-w 0ef99b1e6d style: add Prettier and EditorConfig, format the codebase
Adds prettier 3.9.8 (exact) with a shared config (single quotes,
120 columns, trailing commas), .prettierignore, .editorconfig and the
`format` / `format:check` scripts, then formats all TypeScript,
JavaScript, CSS, JSON and YAML sources.

Purely mechanical: no behaviour change. Typecheck passes, the vitest
suite and the 74 IDE node tests produce the same results as before
(socket-binding tests still cannot run inside this sandbox).
Previously the longest source line was ~3000 characters; reviewing the
following semantic changes now produces readable diffs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:32:43 +08:00

16 lines
555 B
JavaScript

/** Serialize provision/cleanup for a run across generations in this provisioner process. */
export function createRunOperationQueue() {
const pending = new Map();
return async function runOperation(tenantId, runId, operation) {
const key = `${tenantId}\0${runId}`;
const previous = pending.get(key) ?? Promise.resolve();
const current = previous.catch(() => {}).then(operation);
pending.set(key, current);
try {
return await current;
} finally {
if (pending.get(key) === current) pending.delete(key);
}
};
}