refactor for using repomaint
This commit is contained in:
Vendored
+3
-3
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user