fix(server): don't sync blob meta on workspace deleted event (#10334)

close CLOUD-128
This commit is contained in:
fengmk2
2025-02-21 04:11:57 +00:00
parent 785951bbfa
commit 7f833f8c15
3 changed files with 43 additions and 3 deletions

View File

@@ -42,7 +42,7 @@ export class WorkspaceBlobStorage {
return this.provider.get(`${workspaceId}/${key}`);
}
async list(workspaceId: string) {
async list(workspaceId: string, syncBlobMeta = true) {
const blobsInDb = await this.db.blob.findMany({
where: {
workspaceId,
@@ -59,7 +59,9 @@ export class WorkspaceBlobStorage {
blob.key = blob.key.slice(workspaceId.length + 1);
});
this.trySyncBlobsMeta(workspaceId, blobs);
if (syncBlobMeta) {
this.trySyncBlobsMeta(workspaceId, blobs);
}
return blobs.map(blob => ({
key: blob.key,
@@ -182,7 +184,8 @@ export class WorkspaceBlobStorage {
@OnEvent('workspace.deleted')
async onWorkspaceDeleted({ id }: Events['workspace.deleted']) {
const blobs = await this.list(id);
// do not sync blob meta to DB
const blobs = await this.list(id, false);
// to reduce cpu time holding
blobs.forEach(blob => {