mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-05-25 04:24:48 -04:00
Add logging for context issue debugging
This commit is contained in:
parent
65a13a7b17
commit
2d39287df3
1 changed files with 2 additions and 2 deletions
|
@ -43,7 +43,7 @@ type ProgressReporter interface {
|
||||||
|
|
||||||
func downloadFileWithSemaphore(ctx context.Context, progressReporter ProgressReporter, client *http.Client, downloadURL, dstPath string, doRetries bool, sem *semaphore.Weighted) error {
|
func downloadFileWithSemaphore(ctx context.Context, progressReporter ProgressReporter, client *http.Client, downloadURL, dstPath string, doRetries bool, sem *semaphore.Weighted) error {
|
||||||
if err := sem.Acquire(ctx, 1); err != nil {
|
if err := sem.Acquire(ctx, 1); err != nil {
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
defer sem.Release(1)
|
defer sem.Release(1)
|
||||||
|
|
||||||
|
@ -72,7 +72,6 @@ func downloadFileWithSemaphore(ctx context.Context, progressReporter ProgressRep
|
||||||
time.Sleep(retryDelay)
|
time.Sleep(retryDelay)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fmt.Printf("download error after %d attempts, status code: %d, url: %s\n", attempt, resp.StatusCode, downloadURL)
|
|
||||||
return fmt.Errorf("download error after %d attempts, status code: %d", attempt, resp.StatusCode)
|
return fmt.Errorf("download error after %d attempts, status code: %d", attempt, resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +94,7 @@ func downloadFileWithSemaphore(ctx context.Context, progressReporter ProgressRep
|
||||||
time.Sleep(retryDelay)
|
time.Sleep(retryDelay)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
fmt.Printf("Error: %v, cause: %v\n", err, context.Cause(ctx))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
file.Close()
|
file.Close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue