mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-20 03:27:11 +00:00
fix nim-lang#19343 (#19344) [backport]
Ensure HttpClient onProgress is called once per second
Ensure that reported speed is accurate
(cherry picked from commit 58656aa5bb)
This commit is contained in:
committed by
narimiran
parent
30737b3e7f
commit
2539d7a862
@@ -673,7 +673,7 @@ proc reportProgress(client: HttpClient | AsyncHttpClient,
|
||||
progress: BiggestInt) {.multisync.} =
|
||||
client.contentProgress += progress
|
||||
client.oneSecondProgress += progress
|
||||
if (getMonoTime() - client.lastProgressReport).inSeconds > 1:
|
||||
if (getMonoTime() - client.lastProgressReport).inSeconds >= 1:
|
||||
if not client.onProgressChanged.isNil:
|
||||
await client.onProgressChanged(client.contentTotal,
|
||||
client.contentProgress,
|
||||
|
||||
Reference in New Issue
Block a user