mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 12:25:17 +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> {
|
||||
const connection = (await connect(transactorUrl, workspaceId, undefined, {
|
||||
mode: 'backup'
|
||||
|
@ -59,6 +59,7 @@ import {
|
||||
cleanRemovedTransactions,
|
||||
cleanWorkspace,
|
||||
fixCommentDoubleIdCreate,
|
||||
fixMinioBW,
|
||||
fixSkills,
|
||||
optimizeModel
|
||||
} 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
|
||||
.command('clean-removed-transactions <workspace>')
|
||||
.description('set user role')
|
||||
|
Loading…
Reference in New Issue
Block a user