refactor for using repomaint

This commit is contained in:
2026-05-21 22:33:57 -06:00
parent d71a8eb946
commit 80fa7f8392
4 changed files with 23 additions and 6 deletions
+3 -3
View File
@@ -2,21 +2,21 @@ package cache
import "path/filepath"
func (c *Cache) Refresh() error {
func (c *Cache) FetchDB() error {
if !c.refreshMu.TryLock() {
return nil
}
defer c.refreshMu.Unlock()
for _, repo := range c.cfg.mirroredRepos {
if err := c.refreshDB(repo); err != nil {
if err := c.fetchDB(repo); err != nil {
return err
}
}
return nil
}
func (c *Cache) refreshDB(repo string) error {
func (c *Cache) fetchDB(repo string) error {
dbFile := repo + ".db.tar.gz"
dbPath := filepath.Join(repo, "os/x86_64", dbFile)
_, _, err := c.getStream(dbPath)