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;
|
||||
}
|
||||
}
|
||||
const workspace = yield SharedWorkspaceLocking.CreateWorkspace(workspaceIfCreated);
|
||||
yield SharedWorkspaceLocking.LockWorkspace(workspace, runId);
|
||||
const workspace = yield SharedWorkspaceLocking.CreateWorkspace(workspaceIfCreated, runId);
|
||||
return workspace;
|
||||
});
|
||||
}
|
||||
|
|
@ -712,8 +711,11 @@ class SharedWorkspaceLocking {
|
|||
return files.length > 1;
|
||||
});
|
||||
}
|
||||
static CreateWorkspace(workspace) {
|
||||
static CreateWorkspace(workspace, lockId = ``) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (lockId !== ``) {
|
||||
yield SharedWorkspaceLocking.LockWorkspace(workspace, lockId);
|
||||
}
|
||||
const file = `${Date.now()}_workspace`;
|
||||
fs.writeFileSync(file, '');
|
||||
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);
|
||||
await SharedWorkspaceLocking.LockWorkspace(workspace, runId);
|
||||
const workspace = await SharedWorkspaceLocking.CreateWorkspace(workspaceIfCreated, runId);
|
||||
|
||||
return workspace;
|
||||
}
|
||||
|
|
@ -71,7 +70,11 @@ export class SharedWorkspaceLocking {
|
|||
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`;
|
||||
fs.writeFileSync(file, '');
|
||||
await CloudRunnerSystem.Run(
|
||||
|
|
|
|||
Loading…
Reference in New Issue