mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 11:50:56 +00:00
uberf-8149: reset workspace attempts counter tool (#6604)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
parent
434773d794
commit
9459fdecdf
@ -524,7 +524,8 @@ export function devTool (
|
||||
await updateWorkspace(db, info, {
|
||||
mode: 'active',
|
||||
progress: 100,
|
||||
version
|
||||
version,
|
||||
attempts: 0
|
||||
})
|
||||
|
||||
console.log(metricsToString(measureCtx.metrics, 'upgrade', 60))
|
||||
@ -572,7 +573,8 @@ export function devTool (
|
||||
await updateWorkspace(db, ws, {
|
||||
mode: 'active',
|
||||
progress: 100,
|
||||
version
|
||||
version,
|
||||
attempts: 0
|
||||
})
|
||||
} catch (err: any) {
|
||||
console.error(err)
|
||||
@ -1589,6 +1591,25 @@ export function devTool (
|
||||
})
|
||||
})
|
||||
|
||||
program
|
||||
.command('reset-ws-attempts <name>')
|
||||
.description('Reset workspace creation/upgrade attempts counter')
|
||||
.action(async (workspace) => {
|
||||
const { mongodbUri } = prepareTools()
|
||||
await withDatabase(mongodbUri, async (db) => {
|
||||
const info = await getWorkspaceById(db, workspace)
|
||||
if (info === null) {
|
||||
throw new Error(`workspace ${workspace} not found`)
|
||||
}
|
||||
|
||||
await updateWorkspace(db, info, {
|
||||
attempts: 0
|
||||
})
|
||||
|
||||
console.log('Attempts counter for workspace', workspace, 'has been reset')
|
||||
})
|
||||
})
|
||||
|
||||
extendProgram?.(program)
|
||||
|
||||
program.parse(process.argv)
|
||||
|
Loading…
Reference in New Issue
Block a user