mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-08 01:20:27 +00:00
fix: http download fail (#61)
This commit is contained in:
1 parent
c62867e3ef
commit
0a4be165a5
14 files changed
+113
-54
No files matched your search
@@ -102,7 +102,14 @@ func (d *Downloader) Setup() error {
|
||||
|
||||
current := task.fetcher.Progress().TotalDownloaded()
|
||||
task.Progress.Used = task.timer.Used()
|
||||
task.Progress.Speed = current - task.Progress.Downloaded
|
||||
downloaded := current - task.Progress.Downloaded
|
||||
usedTime := float64(d.refreshInterval) / 1000
|
||||
if downloaded == 0 {
|
||||
task.Progress.Speed = int64(float64(task.Progress.Speed) / (usedTime * 1.55))
|
||||
} else {
|
||||
usedTime := float64(d.refreshInterval) / 1000
|
||||
task.Progress.Speed = int64(float64(current-task.Progress.Downloaded) / usedTime)
|
||||
}
|
||||
task.Progress.Downloaded = current
|
||||
d.emit(EventKeyProgress, task)
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ func (cfg *DownloaderConfig) Init() *DownloaderConfig {
|
||||
}
|
||||
|
||||
if cfg.RefreshInterval == 0 {
|
||||
cfg.RefreshInterval = 1000
|
||||
cfg.RefreshInterval = 500
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user