shad-go/distbuild/pkg/worker/download.go
Fedor Korotkiy 1d5c64d8ca Fix linter
2020-04-05 00:55:07 +03:00

26 lines
515 B
Go

package worker
import (
"context"
"errors"
"gitlab.com/slon/shad-go/distbuild/pkg/build"
"gitlab.com/slon/shad-go/distbuild/pkg/filecache"
)
func (w *Worker) pullFiles(ctx context.Context, files map[build.ID]string) error {
for id := range files {
_, unlock, err := w.fileCache.Get(id)
if errors.Is(err, filecache.ErrNotFound) {
if err = w.fileClient.Download(ctx, w.fileCache, id); err != nil {
return err
}
} else if err != nil {
return err
} else {
unlock()
}
}
return nil
}