How to do bulk delete using S3Boto3Storage? without using standard boto3 client

Hi i am using S3Boto3Storage and it works fine when i loop the objects and delete them one by one as below,

@receiver(pre_delete, sender=TicketModel)
def pre_delete_another_model(sender, instance, **kwargs):
    print("inside signals................")
    documents = MyDocuments.objects.filter(ticket=instance)
    for document in documents:
        document.document.delete(save=False)
    documents.delete()

But in above example it is deleting one by one file by calling the s3 api's and it is taking some time, and here the actual model ie TicketModel is being called for bulk delete and in that case all its relevant files has to be removed from s3 and there are many files hence taking lot of time to delete and http request gets timed out if the files are more than 100.

So is there any way to do bulk delete using S3Boto3Storage? so that i can call that in one go. I know there bulk delete is supported in normal boto3 s3 client but is there any possibility to use S3Boto3Storage to use bulk delete?

Back to Top