Skip to content

Commit

Permalink
fix #19343 (#19344) [backport]
Browse files Browse the repository at this point in the history
Ensure HttpClient onProgress is called once per second
Ensure that reported speed is accurate

(cherry picked from commit 58656aa)
  • Loading branch information
zintrepid authored and narimiran committed Jan 11, 2022
1 parent 30737b3 commit 2539d7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pure/httpclient.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2539d7a

Please sign in to comment.