@@ -374,10 +374,14 @@ func Run(exec executor.Executor, log *progress.Logger, cfg *cli.Config) error {
374374 },
375375
376376 PerformanceMetrics : & PerformanceMetrics {
377- ExtensionsCount : len (extensions ),
378- NodePackagesScanMs : nodeScanMs ,
379- NodeGlobalPkgsCount : len (globalPkgs ),
380- NodeProjectsCount : len (nodeProjects ),
377+ ExtensionsCount : len (extensions ),
378+ NodePackagesScanMs : nodeScanMs ,
379+ NodeGlobalPkgsCount : len (globalPkgs ),
380+ NodeProjectsCount : len (nodeProjects ),
381+ BrewFormulaeCount : brewFormulaeCount (brewScans ),
382+ BrewCasksCount : brewCasksCount (brewScans ),
383+ PythonGlobalPkgsCount : len (pythonGlobalPkgs ),
384+ PythonProjectsCount : len (pythonProjects ),
381385 },
382386 }
383387
@@ -392,6 +396,24 @@ func Run(exec executor.Executor, log *progress.Logger, cfg *cli.Config) error {
392396 return nil
393397}
394398
399+ func brewFormulaeCount (scans []model.BrewScanResult ) int {
400+ for _ , s := range scans {
401+ if s .ScanType == "formulae" {
402+ return s .LineCount
403+ }
404+ }
405+ return 0
406+ }
407+
408+ func brewCasksCount (scans []model.BrewScanResult ) int {
409+ for _ , s := range scans {
410+ if s .ScanType == "casks" {
411+ return s .LineCount
412+ }
413+ }
414+ return 0
415+ }
416+
395417func uploadToS3 (ctx context.Context , log * progress.Logger , payload * Payload ) error {
396418 payloadJSON , err := json .Marshal (payload )
397419 if err != nil {
@@ -473,11 +495,15 @@ func uploadToS3(ctx context.Context, log *progress.Logger, payload *Payload) err
473495 // Log retry and backoff
474496 backoff := time .Duration (attempt ) * 2 * time .Second
475497 if err != nil {
476- log .Progress ("S3 upload attempt %d/%d failed (%s), retrying in %s..." , attempt , maxRetries , elapsed , backoff )
498+ log .Progress ("S3 upload attempt %d/%d failed after %s: %v; retrying in %s..." , attempt , maxRetries , elapsed , err , backoff )
477499 } else {
478500 log .Progress ("S3 upload attempt %d/%d got status %d, retrying in %s..." , attempt , maxRetries , putResp .StatusCode , backoff )
479501 }
480- time .Sleep (backoff )
502+ select {
503+ case <- time .After (backoff ):
504+ case <- ctx .Done ():
505+ return ctx .Err ()
506+ }
481507 }
482508 defer func () { _ = putResp .Body .Close () }()
483509 _ , _ = io .Copy (io .Discard , putResp .Body )
0 commit comments