Rename variable

This commit is contained in:
Xpl0itU 2023-08-29 20:59:10 +02:00
parent c888aa7329
commit c906b6a0c9

View file

@ -28,7 +28,7 @@ type ProgressReporter interface {
Cancelled() bool Cancelled() bool
} }
func downloadFile(progressWindow ProgressReporter, client *grab.Client, downloadURL string, dstPath string, doRetries bool) error { func downloadFile(progressReporter ProgressReporter, client *grab.Client, downloadURL string, dstPath string, doRetries bool) error {
filePath := filepath.Base(dstPath) filePath := filepath.Base(dstPath)
for attempt := 1; attempt <= maxRetries; attempt++ { for attempt := 1; attempt <= maxRetries; attempt++ {
@ -39,7 +39,7 @@ func downloadFile(progressWindow ProgressReporter, client *grab.Client, download
req.BufferSize = bufferSize req.BufferSize = bufferSize
resp := client.Do(req) resp := client.Do(req)
progressWindow.UpdateDownloadProgress(resp, filePath) progressReporter.UpdateDownloadProgress(resp, filePath)
t := time.NewTicker(500 * time.Millisecond) t := time.NewTicker(500 * time.Millisecond)
defer t.Stop() defer t.Stop()
@ -48,8 +48,8 @@ func downloadFile(progressWindow ProgressReporter, client *grab.Client, download
for { for {
select { select {
case <-t.C: case <-t.C:
progressWindow.UpdateDownloadProgress(resp, filePath) progressReporter.UpdateDownloadProgress(resp, filePath)
if progressWindow.Cancelled() { if progressReporter.Cancelled() {
resp.Cancel() resp.Cancel()
break Loop break Loop
} }