server for rowboatx

This commit is contained in:
Ramnique Singh 2025-12-02 13:24:58 +05:30
parent ae877e70ae
commit 9ad6331fbc
38 changed files with 2223 additions and 1088 deletions

20
apps/cli/src/runs/lock.ts Normal file
View file

@ -0,0 +1,20 @@
export interface IRunsLock {
lock(runId: string): Promise<boolean>;
release(runId: string): Promise<void>;
}
export class InMemoryRunsLock implements IRunsLock {
private locks: Record<string, boolean> = {};
async lock(runId: string): Promise<boolean> {
if (this.locks[runId]) {
return false;
}
this.locks[runId] = true;
return true;
}
async release(runId: string): Promise<void> {
delete this.locks[runId];
}
}