Automatically remove repositories exceeding a given size
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
If a repository exceeds the repository size limit it should eventually be removed automatically. This removes the need for a support team having to check repositories manually, contact the user, etc.
This system should:
- Notify the user by Email or via the UI that their project is too large and will be deleted in N days
- Delete the project and related resources unless it's no longer over a limit
- Count the number of "offences". If a user keeps creating too large repositories a few times (e.g. 3 or more times) their account is disabled and all repositories are removed
Scheduling wise there are two options:
- We run a periodic Sidekiq worker (e.g. once a day) that gets all repositories that are too large and schedules these for removal (if not done so already). 7 days later the repository is removed unless it's no longer over the size limit
- Whenever a push occurs we check the new repository size and schedule removal if it's too large.
Option 2 means we don't have to query a potentially large list of projects on a daily basis. It however does mean we won't be able to automatically deal with projects that are large but don't receive any pushes. As such I think it's best to start with option 1.
Currently we mark repositories as read-only once they exceed the size threshold. This has the unfortunate side effect that users won't be able to reduce their repository sizes as they can't push to them. There's also no easy way of checking if a push would reduce the size of a repository. Thus, perhaps the best is the following:
- A repository exceeds its limit
- The repository is marked as read-only and the user is notified
- 7 days later the repository is removed
Between step 2 and 3 the user can request an increase of the limit. Once adjusted the repository is available again and it won't be removed (as it no longer exceeds its limit).