@@ -149,13 +149,8 @@ func (s *S3Cache) releaseSemaphore() {
149149 }
150150}
151151
152- // processPackages processes packages using a worker pool
153- func (s * S3Cache ) processPackages (ctx context.Context , pkgs []cache.Package , fn func (context.Context , cache.Package ) error ) error {
154- return s .processPackagesWithWorkers (ctx , pkgs , s .workerCount , fn )
155- }
156-
157- // processPackagesWithWorkers processes packages using a worker pool with a custom worker count
158- func (s * S3Cache ) processPackagesWithWorkers (ctx context.Context , pkgs []cache.Package , workerCount int , fn func (context.Context , cache.Package ) error ) error {
152+ // processPackages processes packages using a worker pool with the specified worker count
153+ func (s * S3Cache ) processPackages (ctx context.Context , pkgs []cache.Package , workerCount int , fn func (context.Context , cache.Package ) error ) error {
159154 jobs := make (chan cache.Package , len (pkgs ))
160155 results := make (chan error , len (pkgs ))
161156 var wg sync.WaitGroup
@@ -290,7 +285,7 @@ func (s *S3Cache) existingPackagesSequential(ctx context.Context, pkgs []cache.P
290285 result := make (map [cache.Package ]struct {})
291286 var mu sync.Mutex
292287
293- err := s .processPackages (ctx , pkgs , func (ctx context.Context , p cache.Package ) error {
288+ err := s .processPackages (ctx , pkgs , s . workerCount , func (ctx context.Context , p cache.Package ) error {
294289 version , err := p .Version ()
295290 if err != nil {
296291 return fmt .Errorf ("failed to get version: %w" , err )
@@ -400,7 +395,7 @@ func (s *S3Cache) Download(ctx context.Context, dst cache.LocalCache, pkgs []cac
400395
401396 // Use higher worker count for downloads to maximize throughput
402397 // TODO: Implement dependency-aware scheduling to prioritize critical path packages
403- err := s .processPackagesWithWorkers (ctx , pkgs , s .downloadWorkerCount , func (ctx context.Context , p cache.Package ) error {
398+ err := s .processPackages (ctx , pkgs , s .downloadWorkerCount , func (ctx context.Context , p cache.Package ) error {
404399 version , err := p .Version ()
405400 if err != nil {
406401 log .WithError (err ).WithField ("package" , p .FullName ()).Warn ("Failed to get version for package, skipping" )
@@ -1024,7 +1019,7 @@ func (s *S3Cache) downloadUnverified(ctx context.Context, p cache.Package, versi
10241019func (s * S3Cache ) Upload (ctx context.Context , src cache.LocalCache , pkgs []cache.Package ) error {
10251020 var uploadErrors []error
10261021
1027- err := s .processPackages (ctx , pkgs , func (ctx context.Context , p cache.Package ) error {
1022+ err := s .processPackages (ctx , pkgs , s . workerCount , func (ctx context.Context , p cache.Package ) error {
10281023 localPath , exists := src .Location (p )
10291024 if ! exists {
10301025 log .WithField ("package" , p .FullName ()).Warn ("package not found in local cache - skipping upload" )
0 commit comments