fix nim-lang#19343 (#19344) [backport]
Ensure HttpClient onProgress is called once per second Ensure that reported speed is accurate
This commit is contained in:
parent
4306d8fb36
commit
58656aa5bb
1 changed files with 1 additions and 1 deletions
|
|
@ -673,7 +673,7 @@ proc reportProgress(client: HttpClient | AsyncHttpClient,
|
||||||
progress: BiggestInt) {.multisync.} =
|
progress: BiggestInt) {.multisync.} =
|
||||||
client.contentProgress += progress
|
client.contentProgress += progress
|
||||||
client.oneSecondProgress += progress
|
client.oneSecondProgress += progress
|
||||||
if (getMonoTime() - client.lastProgressReport).inSeconds > 1:
|
if (getMonoTime() - client.lastProgressReport).inSeconds >= 1:
|
||||||
if not client.onProgressChanged.isNil:
|
if not client.onProgressChanged.isNil:
|
||||||
await client.onProgressChanged(client.contentTotal,
|
await client.onProgressChanged(client.contentTotal,
|
||||||
client.contentProgress,
|
client.contentProgress,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue