-
-
Notifications
You must be signed in to change notification settings - Fork 498
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
Delete old thumbnails from the media/cache directory and the database #740
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #740 +/- ##
==========================================
- Coverage 74.11% 73.49% -0.63%
==========================================
Files 30 30
Lines 1700 1728 +28
==========================================
+ Hits 1260 1270 +10
- Misses 440 458 +18
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Can you please review this PR? |
Hi, I can confirm that I have tested this new command in production and it works. It deletes thumbnails older than |
Instead of having yet another setting, what about allowing the timeout be specified on the command line? It could still default to 10 years when not specified, but |
Hi @claudep, I asked you on February and you didn't have time, so I had to make a decision. I guess a command line argument can be optional, and if it's not given in the command line then use the setting (which defaults to 10 years). Personally I would prefer to have it as a setting, because in the setting we can use Python to calculate the number of seconds from a given number of days or years, while in the command line we have to know exactly how many seconds we need. So I would suggest to use this PR as it is now, from setting, and you can add a new issue and/or PR to give an optional command line argument, but I think it's better that if it's not given then we use Django's setting. I don't have time to rewrite this PR myself to add a command line argument. What do you think? |
I wrote tonight an alternative patch that would avoid new command and setting, by adding an option to |
Sorry, the PR is #745. |
Hi @claudep, I looked at the code of your patch (didn't run it though). Actually I prefer my patch since it also handles image files that do not exist and also deletes or updates all invalid thumbnail keys. Does your patch handles these cases? I also personally don't like the command By the way, I think Thanks, Uri. |
Hi Uri,
For my part, as we already have a command that cleans invalid thumbnail keys, I think it is not useful to do the same in other commands. You can always run the
We could mitigate that risk by requiring the Hopefully other contributors may now chime in and tell what version of the patch they prefer, as I suppose we won't achieve complete agreement between you an me (that's fine for me to disagree, that does not upset me at all). |
Yes but I may run the current version which if run without the
OK. |
Not if the |
I think you don't understand. The current version is 12.9.0. the |
But we are talking here about a future version, as this code is not yet merged. |
Joining late this discussion, I reckon having the option to specify a timeframe within the management command is much clearer, more useful and reduces unnecessary complexity at this stage. I could see Uri's proposal only for example, if a background task or a signal, could be triggered at some point to automate a cleanup process for old assets. |
Address issue #721