zold 0.16.3 → 0.16.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 501a60f570b8ea8f59c348730302b01a744137d53f97442acc3e5ff01c1f6592
4
- data.tar.gz: 82a0a9cb6486d64f904cfb5b59ff4d07ac475ad53c6116425cf411cdbe7577ce
3
+ metadata.gz: 6878147c3eac159d72548009bed74eda692af6b465f82ae47c2fd071de818512
4
+ data.tar.gz: 42401944fc5709a6fb6ea30de6f4af5ebc789538ca87ed204c0386792fbd3011
5
5
  SHA512:
6
- metadata.gz: 8737cc6640eb08f7404fd2e62f7094e00d8fba2a8d98fd3b25ae365052b004961f812982960840c36a82940013c580579f823549a13794d7a9ee3d2b6fed9a17
7
- data.tar.gz: d85dfd371040f27a8174819041a82802594e2c90953ad3d0613e67346248919a3d52cf697977f8aa719de17933f18d81dc5986b89f4401858ba45b3e42f18e7c
6
+ metadata.gz: 97e5df269652087a17d29b3b603cc6b26992e189ce7005cb944ede9559884fdd8d0c1c60bb0463dd5a4dc267f1d6f57c9ad867864b98b679b8fce3431da4a6df
7
+ data.tar.gz: 52ac1e64157997658b5b4be0230960ca61099b4aabdbab7ba43faefd69d4b948a5a4b4a4e0d123c8a0e92915a362aeb63ee333a37a98e4f559f8916231aafacb
@@ -129,7 +129,10 @@ while #{settings.address} is in '#{settings.network}'")
129
129
  headers[Http::SCORE_HEADER] = score.reduced(16).to_s
130
130
  headers['X-Zold-Thread'] = Thread.current.object_id.to_s
131
131
  unless @start.nil?
132
- settings.log.info("Slow response to #{request.url} in #{Age.new(@start, limit: 1)}") if Time.now - @start > 1
132
+ if Time.now - @start > 1
133
+ settings.log.info("Slow response to #{request.request_method} #{request.url} \
134
+ in #{Age.new(@start, limit: 1)}")
135
+ end
133
136
  headers['X-Zold-Milliseconds'] = ((Time.now - @start) * 1000).round.to_s
134
137
  end
135
138
  end
@@ -191,7 +194,7 @@ while #{settings.address} is in '#{settings.network}'")
191
194
  platform: RUBY_PLATFORM,
192
195
  load: Cachy.cache(:a_load, expires_in: 5 * 60) { Usagewatch.uw_load.to_f },
193
196
  threads: "#{Thread.list.select { |t| t.status == 'run' }.count}/#{Thread.list.count}",
194
- wallets: Cachy.cache(:a_wallets, expires_in: 5 * 60) { settings.wallets.all.count },
197
+ wallets: total_wallets,
195
198
  remotes: settings.remotes.all.count,
196
199
  nscore: settings.remotes.all.map { |r| r[:score] }.inject(&:+) || 0,
197
200
  farm: settings.farm.to_json,
@@ -213,7 +216,7 @@ while #{settings.address} is in '#{settings.network}'")
213
216
  protocol: settings.protocol,
214
217
  id: wallet.id.to_s,
215
218
  score: score.to_h,
216
- wallets: Cachy.cache(:a_wallets, expires_in: 5 * 60) { settings.wallets.all.count },
219
+ wallets: total_wallets,
217
220
  mtime: wallet.mtime.utc.iso8601,
218
221
  size: File.size(wallet.path),
219
222
  digest: wallet.digest,
@@ -235,7 +238,7 @@ while #{settings.address} is in '#{settings.network}'")
235
238
  protocol: settings.protocol,
236
239
  id: wallet.id.to_s,
237
240
  score: score.to_h,
238
- wallets: settings.wallets.all.count,
241
+ wallets: total_wallets,
239
242
  key: wallet.key.to_pub,
240
243
  mtime: wallet.mtime.utc.iso8601,
241
244
  digest: wallet.digest,
@@ -355,7 +358,7 @@ while #{settings.address} is in '#{settings.network}'")
355
358
  version: settings.version,
356
359
  alias: settings.node_alias,
357
360
  score: score.to_h,
358
- wallets: settings.wallets.all.count
361
+ wallets: total_wallets
359
362
  )
360
363
  end
361
364
 
@@ -424,6 +427,10 @@ while #{settings.address} is in '#{settings.network}'")
424
427
  yield header
425
428
  end
426
429
 
430
+ def total_wallets
431
+ Cachy.cache(:a_wallets, expires_in: 5 * 60) { settings.wallets.all.count }
432
+ end
433
+
427
434
  def score
428
435
  best = Cachy.cache(:a_score, expires_in: 60) { settings.farm.best }
429
436
  raise 'Score is empty, there is something wrong with the Farm!' if best.empty?
data/lib/zold/version.rb CHANGED
@@ -25,6 +25,6 @@
25
25
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.16.3'
28
+ VERSION = '0.16.4'
29
29
  PROTOCOL = 2
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.3
4
+ version: 0.16.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-30 00:00:00.000000000 Z
11
+ date: 2018-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace