mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Delete Corresponding Minio Bucket When Deleting a Knowledge Base (#7841)
### What problem does this PR solve? Delete Corresponding Minio Bucket When Deleting a Knowledge Base [issue #4113 ](https://github.com/infiniflow/ragflow/issues/4113) ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -118,3 +118,13 @@ class RAGFlowMinio:
|
||||
time.sleep(1)
|
||||
return
|
||||
|
||||
def remove_bucket(self, bucket):
|
||||
try:
|
||||
if self.conn.bucket_exists(bucket):
|
||||
objects_to_delete = self.conn.list_objects(bucket, recursive=True)
|
||||
for obj in objects_to_delete:
|
||||
self.conn.remove_object(bucket, obj.object_name)
|
||||
self.conn.remove_bucket(bucket)
|
||||
except Exception:
|
||||
logging.exception(f"Fail to remove bucket {bucket}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user