Skip to content

Commit

Permalink
Logging response MB and KB/s
Browse files Browse the repository at this point in the history
  • Loading branch information
JunichiIto committed Jul 20, 2023
1 parent 70b682c commit 9135288
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 9135288

Please sign in to comment.