MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / maybeRunGC

Method maybeRunGC

internal/store/gitstore.go:914–934  ·  view source on GitHub ↗
(repoDir string)

Source from the content-addressed store, hash-verified

912}
913
914func (s *GitTokenStore) maybeRunGC(repoDir string) {
915 now := time.Now()
916 if now.Sub(s.lastGC) < gcInterval {
917 return
918 }
919 s.lastGC = now
920
921 repo, err := git.PlainOpen(repoDir)
922 if err != nil {
923 return
924 }
925
926 pruneOpts := git.PruneOptions{
927 OnlyObjectsOlderThan: now,
928 Handler: repo.DeleteObject,
929 }
930 if err := repo.Prune(pruneOpts); err != nil && !errors.Is(err, git.ErrLooseObjectsNotSupported) {
931 return
932 }
933 _ = repo.RepackObjects(&git.RepackConfig{})
934}
935
936// PersistConfig commits and pushes configuration changes to git.
937func (s *GitTokenStore) PersistConfig(_ context.Context) error {

Callers 1

commitAndPushLockedMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected