fix: use retained mode 0 results in no limit
parent
e17bafe800
commit
1c7c6b5c8c
|
|
@ -5118,7 +5118,7 @@ class SharedWorkspaceLocking {
|
||||||
cloud_runner_logger_1.default.log(`run agent ${runId} is trying to access a workspace, free: ${JSON.stringify(workspaces)}`);
|
cloud_runner_logger_1.default.log(`run agent ${runId} is trying to access a workspace, free: ${JSON.stringify(workspaces)}`);
|
||||||
for (const element of workspaces) {
|
for (const element of workspaces) {
|
||||||
const lockResult = yield SharedWorkspaceLocking.LockWorkspace(element, runId, buildParametersContext);
|
const lockResult = yield SharedWorkspaceLocking.LockWorkspace(element, runId, buildParametersContext);
|
||||||
cloud_runner_logger_1.default.log(`run agent ${runId} try lock workspace: ${element} result: ${lockResult}`);
|
cloud_runner_logger_1.default.log(`run agent: ${runId} try lock workspace: ${element} result: ${lockResult}`);
|
||||||
if (lockResult) {
|
if (lockResult) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -5158,7 +5158,7 @@ class SharedWorkspaceLocking {
|
||||||
const workspaces = yield SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext);
|
const workspaces = yield SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext);
|
||||||
for (const element of workspaces) {
|
for (const element of workspaces) {
|
||||||
if (!(yield SharedWorkspaceLocking.IsWorkspaceLocked(element, buildParametersContext)) &&
|
if (!(yield SharedWorkspaceLocking.IsWorkspaceLocked(element, buildParametersContext)) &&
|
||||||
(yield SharedWorkspaceLocking.IsWorkspaceBelowMax(element, buildParametersContext))) {
|
(yield SharedWorkspaceLocking.IsWorkspaceBelowMax(``, buildParametersContext))) {
|
||||||
result.push(element);
|
result.push(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5171,6 +5171,10 @@ class SharedWorkspaceLocking {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const workspaces = yield SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext);
|
const workspaces = yield SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext);
|
||||||
|
if (workspace === ``) {
|
||||||
|
return (workspaces.length < buildParametersContext.maxRetainedWorkspaces ||
|
||||||
|
buildParametersContext.maxRetainedWorkspaces === 0);
|
||||||
|
}
|
||||||
const ordered = [];
|
const ordered = [];
|
||||||
for (const ws of workspaces) {
|
for (const ws of workspaces) {
|
||||||
ordered.push({
|
ordered.push({
|
||||||
|
|
@ -5180,7 +5184,9 @@ class SharedWorkspaceLocking {
|
||||||
}
|
}
|
||||||
ordered.sort((x) => x.timestamp);
|
ordered.sort((x) => x.timestamp);
|
||||||
const matches = ordered.filter((x) => x.name.includes(workspace));
|
const matches = ordered.filter((x) => x.name.includes(workspace));
|
||||||
const isWorkspaceBelowMax = matches.length > 0 && ordered.indexOf(matches[0]) < buildParametersContext.maxRetainedWorkspaces;
|
const isWorkspaceBelowMax = matches.length > 0 &&
|
||||||
|
(ordered.indexOf(matches[0]) < buildParametersContext.maxRetainedWorkspaces ||
|
||||||
|
buildParametersContext.maxRetainedWorkspaces === 0);
|
||||||
cloud_runner_logger_1.default.log(`isWorkspaceBelowMax ${isWorkspaceBelowMax} = ${matches.length} > 0 && ${ordered.indexOf(matches[0])} < ${buildParametersContext.maxRetainedWorkspaces}`);
|
cloud_runner_logger_1.default.log(`isWorkspaceBelowMax ${isWorkspaceBelowMax} = ${matches.length} > 0 && ${ordered.indexOf(matches[0])} < ${buildParametersContext.maxRetainedWorkspaces}`);
|
||||||
return isWorkspaceBelowMax;
|
return isWorkspaceBelowMax;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -49,7 +49,7 @@ export class SharedWorkspaceLocking {
|
||||||
CloudRunnerLogger.log(`run agent ${runId} is trying to access a workspace, free: ${JSON.stringify(workspaces)}`);
|
CloudRunnerLogger.log(`run agent ${runId} is trying to access a workspace, free: ${JSON.stringify(workspaces)}`);
|
||||||
for (const element of workspaces) {
|
for (const element of workspaces) {
|
||||||
const lockResult = await SharedWorkspaceLocking.LockWorkspace(element, runId, buildParametersContext);
|
const lockResult = await SharedWorkspaceLocking.LockWorkspace(element, runId, buildParametersContext);
|
||||||
CloudRunnerLogger.log(`run agent ${runId} try lock workspace: ${element} result: ${lockResult}`);
|
CloudRunnerLogger.log(`run agent: ${runId} try lock workspace: ${element} result: ${lockResult}`);
|
||||||
|
|
||||||
if (lockResult) {
|
if (lockResult) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -100,7 +100,7 @@ export class SharedWorkspaceLocking {
|
||||||
for (const element of workspaces) {
|
for (const element of workspaces) {
|
||||||
if (
|
if (
|
||||||
!(await SharedWorkspaceLocking.IsWorkspaceLocked(element, buildParametersContext)) &&
|
!(await SharedWorkspaceLocking.IsWorkspaceLocked(element, buildParametersContext)) &&
|
||||||
(await SharedWorkspaceLocking.IsWorkspaceBelowMax(element, buildParametersContext))
|
(await SharedWorkspaceLocking.IsWorkspaceBelowMax(``, buildParametersContext))
|
||||||
) {
|
) {
|
||||||
result.push(element);
|
result.push(element);
|
||||||
}
|
}
|
||||||
|
|
@ -117,6 +117,12 @@ export class SharedWorkspaceLocking {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const workspaces = await SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext);
|
const workspaces = await SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext);
|
||||||
|
if (workspace === ``) {
|
||||||
|
return (
|
||||||
|
workspaces.length < buildParametersContext.maxRetainedWorkspaces ||
|
||||||
|
buildParametersContext.maxRetainedWorkspaces === 0
|
||||||
|
);
|
||||||
|
}
|
||||||
const ordered: any[] = [];
|
const ordered: any[] = [];
|
||||||
for (const ws of workspaces) {
|
for (const ws of workspaces) {
|
||||||
ordered.push({
|
ordered.push({
|
||||||
|
|
@ -127,7 +133,9 @@ export class SharedWorkspaceLocking {
|
||||||
ordered.sort((x) => x.timestamp);
|
ordered.sort((x) => x.timestamp);
|
||||||
const matches = ordered.filter((x) => x.name.includes(workspace));
|
const matches = ordered.filter((x) => x.name.includes(workspace));
|
||||||
const isWorkspaceBelowMax =
|
const isWorkspaceBelowMax =
|
||||||
matches.length > 0 && ordered.indexOf(matches[0]) < buildParametersContext.maxRetainedWorkspaces;
|
matches.length > 0 &&
|
||||||
|
(ordered.indexOf(matches[0]) < buildParametersContext.maxRetainedWorkspaces ||
|
||||||
|
buildParametersContext.maxRetainedWorkspaces === 0);
|
||||||
CloudRunnerLogger.log(
|
CloudRunnerLogger.log(
|
||||||
`isWorkspaceBelowMax ${isWorkspaceBelowMax} = ${matches.length} > 0 && ${ordered.indexOf(matches[0])} < ${
|
`isWorkspaceBelowMax ${isWorkspaceBelowMax} = ${matches.length} > 0 && ${ordered.indexOf(matches[0])} < ${
|
||||||
buildParametersContext.maxRetainedWorkspaces
|
buildParametersContext.maxRetainedWorkspaces
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue