mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +03:00
Qfix default workspace mode (#6508)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
parent
6784168b66
commit
7ad23c3443
@ -1490,11 +1490,16 @@ export async function getPendingWorkspace (
|
|||||||
operationQuery,
|
operationQuery,
|
||||||
attemptsQuery,
|
attemptsQuery,
|
||||||
region !== '' ? { region } : defaultRegionQuery,
|
region !== '' ? { region } : defaultRegionQuery,
|
||||||
|
{
|
||||||
|
$or: [
|
||||||
|
{ lastProcessingTime: { $exists: false } },
|
||||||
{ lastProcessingTime: { $lt: Date.now() - processingTimeoutMs } }
|
{ lastProcessingTime: { $lt: Date.now() - processingTimeoutMs } }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
const result =
|
||||||
(await wsCollection.findOneAndUpdate(
|
(await wsCollection.findOneAndUpdate(
|
||||||
query,
|
query,
|
||||||
{
|
{
|
||||||
@ -1512,7 +1517,19 @@ export async function getPendingWorkspace (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)) ?? undefined
|
)) ?? undefined
|
||||||
)
|
|
||||||
|
if (result != null) {
|
||||||
|
ctx.info('getPendingWorkspace', {
|
||||||
|
workspaceId: result.workspace,
|
||||||
|
mode: result.mode,
|
||||||
|
workspaceName: result.workspaceName,
|
||||||
|
operation,
|
||||||
|
region,
|
||||||
|
version
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -220,7 +220,7 @@ export class WorkspaceWorker {
|
|||||||
workspace: BaseWorkspaceInfo,
|
workspace: BaseWorkspaceInfo,
|
||||||
opt: WorkspaceOptions
|
opt: WorkspaceOptions
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
switch (workspace.mode) {
|
switch (workspace.mode ?? 'active') {
|
||||||
case 'creating':
|
case 'creating':
|
||||||
case 'pending-creation':
|
case 'pending-creation':
|
||||||
// We need to either start workspace creation
|
// We need to either start workspace creation
|
||||||
@ -237,6 +237,8 @@ export class WorkspaceWorker {
|
|||||||
// Seems we failed to delete, so let's restore deletion.
|
// Seems we failed to delete, so let's restore deletion.
|
||||||
// TODO: move from account
|
// TODO: move from account
|
||||||
break
|
break
|
||||||
|
default:
|
||||||
|
ctx.error('Unknown workspace mode', { workspace: workspace.workspace, mode: workspace.mode })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user