Automattic / hostmgr

A tool for managing macOS VM hosts
Mozilla Public License 2.0
9 stars 3 forks source link

Ensure the git mirrors manifest contains the most recent caches #56

Closed crazytonyli closed 1 year ago

crazytonyli commented 1 year ago

The git mirrors manifest should contain only the most recent caches. I noticed the current implementation relies on FileManager's subpaths function to return an ordered list where the most recent one comes after the older ones. But the API doc does not explicitly say the returned list is ordered. So I've re-implemented the manifest generation to ensure it contains the most recent ones.

AliSoftware commented 1 year ago

Side question: why does the code generating the manifest file lives in this hostmgr repo? Wouldn't it make more sense to have that part handled by the git-mirror-sync service? (which would update the manifest file with the latest listing of .git.tar immediately after it finishes doing each of its aws s3 sync calls?)

After all, the goal of that manifest file is to have a listing of all the latest cache files pulled from S3 for each repo, and the goal is to keep that manifest file in sync with the available cache content every time that local cache is updated, so would make more sense to me to leave that responsibility to the service actually doing the sync too?

crazytonyli commented 1 year ago

@AliSoftware All good questions, but I don't have the answers unfortunately... I believed this manifest generation command started as an "temporary solution" two years ago and called from the git-mirror-fix service(*). As you suggested in the other comment, the proper way probably is handle this lookup in the git-s3-cache plugin instead.

(*) I didn't link the PR because it's in a private repo, but it's pretty easy to find. 😸

crazytonyli commented 1 year ago

Re-implemented in the other PR ⬆️