Skip to content

Commit 6172791

Browse files
committed
Cleanup
1 parent a66c485 commit 6172791

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

pkg/leeway/cache.go

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,6 @@ func (rs GSUtilRemoteCache) ExistingPackages(pkgs []*Package) (map[*Package]stru
185185
return existingPackages, nil
186186
}
187187

188-
// Helper function to get all possible artifact URLs for a package
189-
func getPackageArtifactURLs(bucketName, version string) []string {
190-
return []string{
191-
fmt.Sprintf("gs://%s/%s.tar.gz", bucketName, version),
192-
fmt.Sprintf("gs://%s/%s.tar", bucketName, version),
193-
}
194-
}
195-
196188
// Download makes a best-effort attempt at downloading previously cached build artifacts
197189
func (rs GSUtilRemoteCache) Download(dst Cache, pkgs []*Package) error {
198190
fmt.Printf("☁️ downloading %d cached build artifacts\n", len(pkgs))
@@ -360,27 +352,22 @@ func (rs *S3RemoteCache) ExistingPackages(pkgs []*Package) (map[*Package]struct{
360352
defer wg.Done()
361353

362354
// Check for .tar.gz first
363-
if stat, err := rs.hasObject(ctx, keys.gzKey); err != nil {
364-
log.WithField("bucket", rs.BucketName).WithField("key", keys.gzKey).
365-
Debugf("Failed to check for remote cached object: %s", err)
366-
} else if stat {
355+
if rs.checkObjectExists(ctx, keys.gzKey) {
367356
mu.Lock()
368357
existingPackages[pkg] = struct{}{}
369358
mu.Unlock()
370359
return
371360
}
372361

373362
// If .tar.gz doesn't exist, check for .tar
374-
if stat, err := rs.hasObject(ctx, keys.tarKey); err != nil {
375-
log.WithField("bucket", rs.BucketName).WithField("key", keys.tarKey).
376-
Debugf("Failed to check for remote cached object: %s", err)
377-
} else if stat {
363+
if rs.checkObjectExists(ctx, keys.tarKey) {
378364
mu.Lock()
379365
existingPackages[pkg] = struct{}{}
380366
mu.Unlock()
381367
}
382368
}(pkg, keys)
383369
}
370+
384371
wg.Wait()
385372

386373
log.WithField("bucket", rs.BucketName).

0 commit comments

Comments
 (0)