From 6b2fb9dfc4e0e8972cb0a2b4afdbea4fdcee5d8a Mon Sep 17 00:00:00 2001 From: Wilfred Asomani Date: Fri, 4 Aug 2023 17:08:50 +0000 Subject: [PATCH] web/satellite: use force delete bucket This change modifies delete bucket requests to optin for force delete using the x-minio-force-delete header. This solves an issue where buckets deletes will be slow for buckets that have many objects. This change is to make the UI emulate uplink rb --force since it has better performance. Issue: https://github.com/storj/customer-issues/issues/930 Change-Id: I0a74c1a201e74b07eb30b917adf78ef865ce2003 --- web/satellite/src/store/modules/bucketsStore.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/satellite/src/store/modules/bucketsStore.ts b/web/satellite/src/store/modules/bucketsStore.ts index 1f3dd8dee..f6c3deca5 100644 --- a/web/satellite/src/store/modules/bucketsStore.ts +++ b/web/satellite/src/store/modules/bucketsStore.ts @@ -98,6 +98,14 @@ export const useBucketsStore = defineStore('buckets', () => { }; state.s3ClientForDelete = new S3Client(s3Config); + + state.s3ClientForDelete.middlewareStack.add( + (next, _) => (args) => { + (args.request as { headers: {key:string} }).headers['x-minio-force-delete'] = 'true'; + return next(args); + }, + { step: 'build' }, + ); } function setEdgeCredentialsForCreate(credentials: EdgeCredentials): void {