Skip to content
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

[feature] Cleanup unattached local media #680

Merged
merged 6 commits into from
Jun 30, 2022
Merged

Conversation

tsmethurst
Copy link
Contributor

This PR closes #666 by adding some logic for cleaning up local media that was uploaded but never used, or media that was attached to a status which was subsequently deleted.

The time limit to keep unattached media around is currently hardcoded at 3 days. This was chosen because it seems very unlikely that someone would upload media, leave it unattached, and then after 3 days return to it and attach it to a status. Most of the time users upload something and then simply never use it, or they delete and redraft so that the media only stays unused for a few minutes at most.

The cleanup is triggered on instance startup, and every night @ midnight along with the other cleaning jobs. It's also triggerable by an admin calling the /api/v1/admin/media_cleanup endpoint

@tsmethurst tsmethurst merged commit 9e7d022 into main Jun 30, 2022
@tsmethurst tsmethurst deleted the media_unattached_cleanup branch June 30, 2022 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Clean up unused local media
1 participant