- Maniphest Tasks
- T181176: Need to make the number of cached revisions configurable
- Group Reviewers
- rMSCA70c0e1a5074a: Add a config key `cache_revs` to specify how many revs to keep
- Patch without arc
- git checkout -b D900 && curl -L https://phabricator.wikimedia.org/D900?download=true | git apply
didn't test it
Seems to work as expected, although I made a note about some old logic that looks like it would result in keeping more rev_dirs than expected (not a big deal, but something to keep in mind).
Now that I'm looking at this again, this logic is probably not correct. We should probably remove the off_limits directories from the set before removing the cache_revs oldest directories.
The current logic doesn't work as expected in the case of a manual deploy of an old revision and a subsequent manual deploy of another old revision that then fails. This would mean that we have 2 old offlimits directories, then another n cache_revs. So we skip removing n old cache_revs (let's say 2), then we have 2 off_limits revs which would leave 4 directories. Anyway, I think this is all solved by doing something like (untested):
final_rev_dirs = [dir for dir in rev_dirs_by_ctime if dir not in off_limits] cache_revs = max(cache_revs - len(off_limits), 0) for rev_dir in final_rev_dirs[cache_revs:]: ...