mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
fix(server): don't sync blob meta on workspace deleted event (#10334)
close CLOUD-128
This commit is contained in:
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user