Better locking

pull/461/head
Frostebite 2022-09-29 22:25:43 +01:00
parent 7af054a390
commit 6ab62f966c
3 changed files with 7 additions and 1 deletions

3
dist/index.js vendored
View File

@ -689,6 +689,9 @@ class SharedWorkspaceLocking {
} }
static ReleaseWorkspace(workspace, runId) { static ReleaseWorkspace(workspace, runId) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (!(yield SharedWorkspaceLocking.DoesWorkspaceExist(workspace))) {
return true;
}
const file = (yield SharedWorkspaceLocking.GetAllLocks(workspace)).filter((x) => x.includes(`_${runId}_lock`)); const file = (yield SharedWorkspaceLocking.GetAllLocks(workspace)).filter((x) => x.includes(`_${runId}_lock`));
cloud_runner_logger_1.default.log(`${JSON.stringify(yield SharedWorkspaceLocking.GetAllLocks(workspace))}`); cloud_runner_logger_1.default.log(`${JSON.stringify(yield SharedWorkspaceLocking.GetAllLocks(workspace))}`);
cloud_runner_logger_1.default.log(`Deleting file ${file}`); cloud_runner_logger_1.default.log(`Deleting file ${file}`);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -76,6 +76,9 @@ export class SharedWorkspaceLocking {
} }
public static async ReleaseWorkspace(workspace: string, runId: string): Promise<boolean> { public static async ReleaseWorkspace(workspace: string, runId: string): Promise<boolean> {
if (!(await SharedWorkspaceLocking.DoesWorkspaceExist(workspace))) {
return true;
}
const file = (await SharedWorkspaceLocking.GetAllLocks(workspace)).filter((x) => x.includes(`_${runId}_lock`)); const file = (await SharedWorkspaceLocking.GetAllLocks(workspace)).filter((x) => x.includes(`_${runId}_lock`));
CloudRunnerLogger.log(`${JSON.stringify(await SharedWorkspaceLocking.GetAllLocks(workspace))}`); CloudRunnerLogger.log(`${JSON.stringify(await SharedWorkspaceLocking.GetAllLocks(workspace))}`);
CloudRunnerLogger.log(`Deleting file ${file}`); CloudRunnerLogger.log(`Deleting file ${file}`);