zold 0.24.2 → 0.24.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8d740810d7c8bd0686a665d824c67cb3bc8db247689fc5c686b8bece3f66a0a
4
- data.tar.gz: 72109b1959e05e5d10c907efa6f6604091c98bef735904d56c242adaa11c0abf
3
+ metadata.gz: 1f141b00987a42599c720d88c575c143a9042ea23742913605b729cbb422336c
4
+ data.tar.gz: 07a5846062d9fb519954f95e781c4f21beec04fef41dcb87b4796d28806839a6
5
5
  SHA512:
6
- metadata.gz: 97cd7c7ac22d39688eaa33bd1b4eaf08734c8d3d5c644ba5293793eccb5808ac9f4a85301b7b6bb0ad78c5bb76a077ebe5987c1838d413fdf0142106de806684
7
- data.tar.gz: d50fd2647a8d7cdfa7f58461a224f522e21050ff0656d9428e5674cecea77bbae83712f5eb5ce70d1f704b811224e4072f66365340af94cc66af248e64581c12
6
+ metadata.gz: 80a05326c5e6617cf9d840cde37078e6acaf6b8a88f9c175f711a4704454e7410d4e5dcc63b7433953d278d556aa8ef44bef556ec8ee0a6dd147421b642568dd
7
+ data.tar.gz: 464a2a34649948507b5fc321ff419005d2786ae16fa8ec6e2751f50e2b9b2095945a4e25e054748f4144aed07891b7a44420ac5db75bc0830690fee9f1304be8
@@ -117,6 +117,9 @@ Available options:"
117
117
  o.integer '--depth',
118
118
  'The amount of update cycles to run, in order to fetch as many nodes as possible (default: 2)',
119
119
  default: 2
120
+ o.integer '--threads',
121
+ "How many threads to use for updating, electing, etc. (default: #{[Concurrent.processor_count, 4].min})",
122
+ default: [Concurrent.processor_count, 4].min
120
123
  o.string '--network',
121
124
  "The name of the network we work in (default: #{Wallet::MAINET})",
122
125
  required: true,
@@ -226,7 +229,7 @@ Available options:"
226
229
  # Returns an array of Zold::Score
227
230
  def elect(opts)
228
231
  scores = []
229
- @remotes.iterate(@log, farm: @farm) do |r|
232
+ @remotes.iterate(@log, farm: @farm, threads: opts['threads']) do |r|
230
233
  uri = '/'
231
234
  res = r.http(uri).get
232
235
  r.assert_code(200, res)
@@ -266,7 +269,7 @@ Available options:"
266
269
  seen = Set.new
267
270
  capacity = []
268
271
  opts['depth'].times do
269
- @remotes.iterate(@log, farm: @farm) do |r|
272
+ @remotes.iterate(@log, farm: @farm, threads: opts['threads']) do |r|
270
273
  if seen.include?(r.to_mnemo)
271
274
  @log.debug("#{r} seen already, won't check again")
272
275
  next
data/lib/zold/remotes.rb CHANGED
@@ -193,10 +193,10 @@ at #{response.headers['X-Zold-Path']}"
193
193
 
194
194
  # Go through the list of remotes and call a provided block for each
195
195
  # of them. See how it's used, for example, in fetch.rb.
196
- def iterate(log, farm: Farm::Empty.new)
196
+ def iterate(log, farm: Farm::Empty.new, threads: 1)
197
197
  raise 'Log can\'t be nil' if log.nil?
198
198
  raise 'Farm can\'t be nil' if farm.nil?
199
- Hands.exec(Concurrent.processor_count * 4, all) do |r, idx|
199
+ Hands.exec(threads, all) do |r, idx|
200
200
  Thread.current.name = "remotes-#{idx}@#{r[:host]}:#{r[:port]}"
201
201
  start = Time.now
202
202
  best = farm.best[0]
data/lib/zold/version.rb CHANGED
@@ -25,7 +25,7 @@
25
25
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.24.2'
28
+ VERSION = '0.24.3'
29
29
  PROTOCOL = 2
30
30
  REPO = 'zold-io/zold'
31
31
  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.24.2
4
+ version: 0.24.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-01 00:00:00.000000000 Z
11
+ date: 2019-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -764,7 +764,7 @@ licenses:
764
764
  - MIT
765
765
  metadata: {}
766
766
  post_install_message: |-
767
- Thanks for installing Zold 0.24.2!
767
+ Thanks for installing Zold 0.24.3!
768
768
  Study our White Paper: https://papers.zold.io/wp.pdf
769
769
  Read our blog posts: https://blog.zold.io
770
770
  Try ZLD online wallet at: https://wts.zold.io