Opened 13 years ago

Closed 12 years ago

Last modified 9 years ago

#254 closed defect (fixed)

Directories in queue are not deleted automatically — at Version 5

Reported by: Aleksej Owned by:
Priority: trivial Milestone:
Component: programming Keywords: cloudfiles, bitesized
Cc: joar Parent Tickets:

Description (last modified by Christopher Allan Webber)

There are empty directories left in
user\_dev/media/queue/media\_entries/ after files are uploaded.



Change History (5)

comment:1 by Christopher Allan Webber, 13 years ago

I've had some thoughts on how to deal with this.

We want something along the lines of "rmdir directory", not "rm -rf
directory". We don't want to be at risk of deleting all
subdirectories if they have content in them. All we care about here
is wiping empty stuff.

So maybe along those lines we should have a method like
StorageInterface.clear\_empty\_dirs() that wipes all empty
subdirectories under a particular path. If a subdirectory has
things in it, it's simply skipped. StorageInterface implementations
that don't need this can just pass / return immediately (ie, this
applies to BasicFileStorage but not CloudFileStorage).

There's a small possibility of a race condition if you shoot too
low on the tree with clear\_empty\_dirs, so we should use this
sparingly just on particular things, like specifically the
subdirectory we know we allocated for this media entry's queued
media.

Does that make sense?



comment:2 by Will Kahn-Greene, 13 years ago

The original url for this bug was http://bugs.foocorp.net/issues/589 .

comment:3 by spaetz, 12 years ago

I have now a branch that fixes this issue. It is in my branch '565+254_delete_queue_directory' (on top of my branch for #565 but this can be applied independent of that one too).

It does 2 things:

1) Implement deletion of empty directories as well as regular files in the FileStorage backend

2) Delete the {task_id} directory that is being created for each submission and never cleaned up (hence this bug report). It explicitely deletes the uploaded file and the containing directory if its empty and will fail to recursively delete anything else (e.g. if by bad lack we happen to store our queued files in "/")

Last edited 12 years ago by spaetz (previous) (diff)

comment:4 by spaetz, 12 years ago

Keywords: review added
Milestone: 0.3.3

I just updated this branch to latest master. It is still on top of the branch for #565. but would be pretty easy to disentangle. Please review and merge :-)

comment:5 by Christopher Allan Webber, 12 years ago

Description: modified (diff)
Resolution: fixed
Status: acceptedclosed

Ah yeah that's fixed now!

Thanks! :)

Note: See TracTickets for help on using tickets.