pull/496/head
Frostebite 2023-02-19 02:22:25 +00:00
parent bac0e39b27
commit 6f6a410a38
3 changed files with 19 additions and 33 deletions

24
dist/index.js generated vendored
View File

@ -5765,24 +5765,18 @@ class SharedWorkspaceLocking {
if (!cloud_runner_options_1.default.retainWorkspaces) {
return false;
}
try {
if (yield SharedWorkspaceLocking.DoesCacheKeyTopLevelExist(buildParametersContext)) {
const workspaces = yield SharedWorkspaceLocking.GetFreeWorkspaces(buildParametersContext);
cloud_runner_logger_1.default.log(`run agent ${runId} is trying to access a workspace, free: ${JSON.stringify(workspaces)}`);
for (const element of workspaces) {
yield new Promise((promise) => setTimeout(promise, 1000));
const lockResult = yield SharedWorkspaceLocking.LockWorkspace(element, runId, buildParametersContext);
cloud_runner_logger_1.default.log(`run agent: ${runId} try lock workspace: ${element} locking attempt result: ${lockResult}`);
if (lockResult) {
return true;
}
if (yield SharedWorkspaceLocking.DoesCacheKeyTopLevelExist(buildParametersContext)) {
const workspaces = yield SharedWorkspaceLocking.GetFreeWorkspaces(buildParametersContext);
cloud_runner_logger_1.default.log(`run agent ${runId} is trying to access a workspace, free: ${JSON.stringify(workspaces)}`);
for (const element of workspaces) {
yield new Promise((promise) => setTimeout(promise, 1000));
const lockResult = yield SharedWorkspaceLocking.LockWorkspace(element, runId, buildParametersContext);
cloud_runner_logger_1.default.log(`run agent: ${runId} try lock workspace: ${element} locking attempt result: ${lockResult}`);
if (lockResult) {
return true;
}
}
}
catch (error) {
cloud_runner_logger_1.default.log(JSON.stringify(error, undefined, 4));
return false;
}
const createResult = yield SharedWorkspaceLocking.CreateWorkspace(workspace, buildParametersContext, runId);
const lockResult = yield SharedWorkspaceLocking.LockWorkspace(workspace, runId, buildParametersContext);
cloud_runner_logger_1.default.log(`run agent ${runId} didn't find a free workspace so created: ${workspace} createWorkspaceSuccess: ${createResult} Lock:${lockResult}`);

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -55,28 +55,20 @@ export class SharedWorkspaceLocking {
return false;
}
try {
if (await SharedWorkspaceLocking.DoesCacheKeyTopLevelExist(buildParametersContext)) {
const workspaces = await SharedWorkspaceLocking.GetFreeWorkspaces(buildParametersContext);
if (await SharedWorkspaceLocking.DoesCacheKeyTopLevelExist(buildParametersContext)) {
const workspaces = await SharedWorkspaceLocking.GetFreeWorkspaces(buildParametersContext);
CloudRunnerLogger.log(`run agent ${runId} is trying to access a workspace, free: ${JSON.stringify(workspaces)}`);
for (const element of workspaces) {
await new Promise((promise) => setTimeout(promise, 1000));
const lockResult = await SharedWorkspaceLocking.LockWorkspace(element, runId, buildParametersContext);
CloudRunnerLogger.log(
`run agent ${runId} is trying to access a workspace, free: ${JSON.stringify(workspaces)}`,
`run agent: ${runId} try lock workspace: ${element} locking attempt result: ${lockResult}`,
);
for (const element of workspaces) {
await new Promise((promise) => setTimeout(promise, 1000));
const lockResult = await SharedWorkspaceLocking.LockWorkspace(element, runId, buildParametersContext);
CloudRunnerLogger.log(
`run agent: ${runId} try lock workspace: ${element} locking attempt result: ${lockResult}`,
);
if (lockResult) {
return true;
}
if (lockResult) {
return true;
}
}
} catch (error) {
CloudRunnerLogger.log(JSON.stringify(error, undefined, 4));
return false;
}
const createResult = await SharedWorkspaceLocking.CreateWorkspace(workspace, buildParametersContext, runId);