mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-15 12:55:59 +00:00
Fix bw tool (#4167)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
47b4f3f14d
commit
56d05e28f7
@ -145,6 +145,25 @@ export async function cleanWorkspace (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function fixMinioBW (workspaceId: WorkspaceId, minio: MinioService): Promise<void> {
|
||||||
|
console.log('try clean bw miniature for ', workspaceId.name)
|
||||||
|
const from = new Date(new Date().setDate(new Date().getDate() - 7))
|
||||||
|
const list = await minio.list(workspaceId)
|
||||||
|
console.log('found', list.length)
|
||||||
|
let removed = 0
|
||||||
|
for (const obj of list) {
|
||||||
|
if (obj.lastModified < from) continue
|
||||||
|
if (obj.name.includes('%size%')) {
|
||||||
|
await minio.remove(workspaceId, [obj.name])
|
||||||
|
removed++
|
||||||
|
if (removed % 100 === 0) {
|
||||||
|
console.log('removed: ', removed)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('FINISH, removed: ', removed)
|
||||||
|
}
|
||||||
|
|
||||||
export async function cleanRemovedTransactions (workspaceId: WorkspaceId, transactorUrl: string): Promise<void> {
|
export async function cleanRemovedTransactions (workspaceId: WorkspaceId, transactorUrl: string): Promise<void> {
|
||||||
const connection = (await connect(transactorUrl, workspaceId, undefined, {
|
const connection = (await connect(transactorUrl, workspaceId, undefined, {
|
||||||
mode: 'backup'
|
mode: 'backup'
|
||||||
|
@ -59,6 +59,7 @@ import {
|
|||||||
cleanRemovedTransactions,
|
cleanRemovedTransactions,
|
||||||
cleanWorkspace,
|
cleanWorkspace,
|
||||||
fixCommentDoubleIdCreate,
|
fixCommentDoubleIdCreate,
|
||||||
|
fixMinioBW,
|
||||||
fixSkills,
|
fixSkills,
|
||||||
optimizeModel
|
optimizeModel
|
||||||
} from './clean'
|
} from './clean'
|
||||||
@ -493,6 +494,11 @@ export function devTool (
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
program.command('fix-bw-workspace <workspace>').action(async (workspace: string) => {
|
||||||
|
const { minio } = prepareTools()
|
||||||
|
await fixMinioBW(getWorkspaceId(workspace, productId), minio)
|
||||||
|
})
|
||||||
|
|
||||||
program
|
program
|
||||||
.command('clean-removed-transactions <workspace>')
|
.command('clean-removed-transactions <workspace>')
|
||||||
.description('set user role')
|
.description('set user role')
|
||||||
|
Loading…
Reference in New Issue
Block a user