-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Periodically clean up old temporary uploads #19
Comments
Great to hear that you're integrating this into your project. :-) I agree that periodic cleanup of stale temporary uploads would be good. Celery could be a good way to do this but I wonder if it may be a little heavyweight? I wonder if perhaps something more lightweight might be easier to integrate and keep the app lighter on large dependencies? For example, maybe django-bakground-tasks or django-periodically could be suitable (I've never used either of these)? Thanks for your interest in the project and your contributions, @pasevin. |
If we're talking about built in feature of clean up, then you're probably right. Basically you as a developer have to set up your Celery task runner and then django-drf-filepond just works with it. Your suggestion is probably better in the way that as a developer I don't have to worry about setting up my task runner, the library would handle that. |
I think that was my concern when I mentioned having something more lightweight - the need to be running a task runner which adds another element of complexity and another dependency for the person using I guess Celery is going to be more feature-rich and likely to be more robust than the other options I highlighted but I've not used them before so don't know for sure. I'm intending to investigate the two Django apps mentioned above to see how practical it would be to use these to provide the sort of clean-up functionality you suggested. If they're not looking like the right sort of thing then Celery will be the way to go, I think. |
Instead of using a scheduled cleanup, you could trigger an async cleanup every time a new file is uploaded into the temporary storage. A setting This would require no additional dependencies and only run when the storage is actually used. While it will probably run more often on high-load applications than a periodical approach would, it would also run less resource-intensive, since temporary upload won't stockpile for long. |
Thanks @larsschellhas, I think this would be a good way to address this longstanding issue without having to introduce additional dependencies or set up cron jobs external to the application. I guess a further extension to this, to help manage resources on high-load applications, might be to simply store a timestamp when the last cleanup was done and then have something like a |
Agreed, that might be a helpful solution for high-load scenarios, too. However, I'm wondering whether (especially) in high-load scenarios, there is a trade-off between the larger peak loads of lower frequencies vs. smaller peak loads of higher frequencies, @jcohen02 |
While integrating with celery etc. would be cool, I think just providing a management command (and python function) would be flexible enough for a start. |
Would be awesome to have this library integrate with Celery to clean up from time to time the stale files in temporary upload folder and from database.
Thanks for your work! I'm almost done with integrating this library in my project :)
The text was updated successfully, but these errors were encountered: