Skip to content

Commit

Permalink
Merge pull request #90 from SonicGarden/add-response-size
Browse files Browse the repository at this point in the history
[review] Logging response MB and KB/s
  • Loading branch information
aki77 authored Jul 20, 2023
2 parents 70b682c + 9135288 commit 33d5a86
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/copy_tuner_client/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ def download
response = http.request(request)
t_ms = ((Time.now - t) * 1000).to_i
if check response
log "Downloaded translations (#{t_ms}ms)"
bytesize = response.body.bytesize
kb = bytesize / 1024.0
mb = kb / 1024.0
t_s = t_ms / 1000.0
kbs = kb / t_s
log "Downloaded translations (#{t_ms}ms, #{mb.round(1)}MB, #{kbs.round(1)}KB/s)"
yield JSON.parse(response.body)
else
log "No new translations (#{t_ms}ms)"
Expand Down

0 comments on commit 33d5a86

Please sign in to comment.