Lock workspace before creating workspace file to allow for an unblockable creation sequence with guarenteed lock for the original creator
parent
0f75d10854
commit
a34c72a0ad
|
|
@ -672,8 +672,7 @@ class SharedWorkspaceLocking {
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const workspace = yield SharedWorkspaceLocking.CreateWorkspace(workspaceIfCreated);
|
const workspace = yield SharedWorkspaceLocking.CreateWorkspace(workspaceIfCreated, runId);
|
||||||
yield SharedWorkspaceLocking.LockWorkspace(workspace, runId);
|
|
||||||
return workspace;
|
return workspace;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -712,8 +711,11 @@ class SharedWorkspaceLocking {
|
||||||
return files.length > 1;
|
return files.length > 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static CreateWorkspace(workspace) {
|
static CreateWorkspace(workspace, lockId = ``) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (lockId !== ``) {
|
||||||
|
yield SharedWorkspaceLocking.LockWorkspace(workspace, lockId);
|
||||||
|
}
|
||||||
const file = `${Date.now()}_workspace`;
|
const file = `${Date.now()}_workspace`;
|
||||||
fs.writeFileSync(file, '');
|
fs.writeFileSync(file, '');
|
||||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(`aws s3 cp ./${file} ${SharedWorkspaceLocking.workspaceRoot}${workspace}/${file}`, false, true);
|
yield cloud_runner_system_1.CloudRunnerSystem.Run(`aws s3 cp ./${file} ${SharedWorkspaceLocking.workspaceRoot}${workspace}/${file}`, false, true);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -30,8 +30,7 @@ export class SharedWorkspaceLocking {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const workspace = await SharedWorkspaceLocking.CreateWorkspace(workspaceIfCreated);
|
const workspace = await SharedWorkspaceLocking.CreateWorkspace(workspaceIfCreated, runId);
|
||||||
await SharedWorkspaceLocking.LockWorkspace(workspace, runId);
|
|
||||||
|
|
||||||
return workspace;
|
return workspace;
|
||||||
}
|
}
|
||||||
|
|
@ -71,7 +70,11 @@ export class SharedWorkspaceLocking {
|
||||||
return files.length > 1;
|
return files.length > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async CreateWorkspace(workspace: string) {
|
public static async CreateWorkspace(workspace: string, lockId: string = ``) {
|
||||||
|
if (lockId !== ``) {
|
||||||
|
await SharedWorkspaceLocking.LockWorkspace(workspace, lockId);
|
||||||
|
}
|
||||||
|
|
||||||
const file = `${Date.now()}_workspace`;
|
const file = `${Date.now()}_workspace`;
|
||||||
fs.writeFileSync(file, '');
|
fs.writeFileSync(file, '');
|
||||||
await CloudRunnerSystem.Run(
|
await CloudRunnerSystem.Run(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue