Opened 11 years ago

Last modified 8 years ago

#612 new defect

MediaFile deletion bails on with missing files on cloudfiles

Reported by: spaetz Owned by:
Priority: major Milestone:
Component: programming Keywords:
Cc: Parent Tickets:

Description

MediaEntry.delete does this:

        try:
            delete_media_files(self)
        except OSError, error:

joar says that the cloudfiles plugin raises a different exception when files are missing (somthing that is an IOError subclass).

So the very least we need to do here, is to also catch IOError and make them non-fatal.

Even better, if we could make the file deletion be celery tasks. In this case we would get automatic retries in case of failures (with separate-process celery) even after some waiting time.

Change History (1)

comment:1 by Loic Dachary, 8 years ago

It looks like a way to fix this would be for mediagoblin/storage/cloudfiles.py to remap the cloudfile error condition indicating that a file does not exist into OSError for the benefit of MediaEntry.delete. For reference, here is the current code that would need to be patched:

    def delete_file(self, filepath):
        # TODO: Also delete unused directories if empty (safely, with
        # checks to avoid race conditions).
        try:
            self.container.delete_object(
                self._resolve_filepath(filepath))
        except cloudfiles.container.ResponseError:
            pass
        finally:
            pass
Last edited 8 years ago by Loic Dachary (previous) (diff)
Note: See TracTickets for help on using tickets.