zold 0.17.7 → 0.17.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zold/commands/remote.rb +21 -14
- data/lib/zold/commands/routines/reconnect.rb +1 -1
- data/lib/zold/node/farm.rb +2 -1
- data/lib/zold/node/front.rb +1 -1
- data/lib/zold/version.rb +1 -1
- data/test/node/test_front.rb +9 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6e1c255573260dfc82b50fec8a41ae005471dbaec11a736983de5a609e41630
|
4
|
+
data.tar.gz: 99af27923788d3878f924d6f3b265e9a2d37ee49ca37b44ef30421901c73658b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e724f19149afaeeb61a4053052da0288339c8ea23235de66ed66baa5ad15c0b80fe912081f26096ba30101dc9e650c47257b1157c29ca9d751d137efcd3a5516
|
7
|
+
data.tar.gz: 72055148011cc61cf7a2828c0b0315127146f4ce22738ba7f956084ba658ad103a8f2df3e6d4ff7a9d8e8ce6318dba4e71d7b6451bdd98738965d3a84a9864bb
|
data/lib/zold/commands/remote.rb
CHANGED
@@ -102,6 +102,9 @@ Available options:"
|
|
102
102
|
o.bool '--skip-ping',
|
103
103
|
'Don\'t ping back the node when adding it (not recommended)',
|
104
104
|
default: false
|
105
|
+
o.bool '--ignore-ping',
|
106
|
+
'Don\'t fail if ping fails, just report the problem in the log',
|
107
|
+
default: false
|
105
108
|
o.integer '--depth',
|
106
109
|
'The amount of update cycles to run, in order to fetch as many nodes as possible (default: 2)',
|
107
110
|
default: 2
|
@@ -191,12 +194,13 @@ Available options:"
|
|
191
194
|
@log.debug("#{host}:#{port} already exists, won't add because of --ignore-if-exists")
|
192
195
|
return
|
193
196
|
end
|
194
|
-
unless opts
|
195
|
-
|
196
|
-
|
197
|
+
return unless ping(host, port, opts)
|
198
|
+
if @remotes.exists?(host, port)
|
199
|
+
@log.info("#{host}:#{port} already exists among #{@remotes.all.count} others")
|
200
|
+
else
|
201
|
+
@remotes.add(host, port)
|
202
|
+
@log.info("#{host}:#{port} added to the list, #{@remotes.all.count} total")
|
197
203
|
end
|
198
|
-
@remotes.add(host, port)
|
199
|
-
@log.info("#{host}:#{port} added to the list, #{@remotes.all.count} total")
|
200
204
|
end
|
201
205
|
|
202
206
|
def remove(host, port, _)
|
@@ -258,22 +262,16 @@ Available options:"
|
|
258
262
|
Semantic::Version.new(VERSION) < Semantic::Version.new(gem.last_version)
|
259
263
|
if opts['reboot']
|
260
264
|
@log.info("#{r}: their version #{json['version']} is higher than mine #{VERSION}, reboot! \
|
261
|
-
|
265
|
+
(use --never-reboot to avoid this from happening)")
|
262
266
|
terminate
|
263
267
|
end
|
264
268
|
@log.debug("#{r}: their version #{json['version']} is higher than mine #{VERSION}, \
|
265
|
-
|
269
|
+
it's recommended to reboot, but I don't do it because of --never-reboot")
|
266
270
|
end
|
267
271
|
if cycle.positive?
|
268
272
|
json['all'].each do |s|
|
269
|
-
if opts['ignore-node'].include?("#{s['host']}:#{s['port']}")
|
270
|
-
@log.debug("#{s['host']}:#{s['port']}, which is found at #{r} \
|
271
|
-
won't be added since it's in the --ignore-node list")
|
272
|
-
next
|
273
|
-
end
|
274
273
|
next if @remotes.exists?(s['host'], s['port'])
|
275
|
-
|
276
|
-
@log.info("#{s['host']}:#{s['port']} found at #{r} and added to the list of #{@remotes.all.count}")
|
274
|
+
add(s['host'], s['port'], opts)
|
277
275
|
end
|
278
276
|
end
|
279
277
|
capacity << { host: score.host, port: score.port, count: json['all'].count }
|
@@ -304,5 +302,14 @@ Available options:"
|
|
304
302
|
require_relative '../node/front'
|
305
303
|
Front.stop!
|
306
304
|
end
|
305
|
+
|
306
|
+
def ping(host, port, opts)
|
307
|
+
return true if opts['skip-ping']
|
308
|
+
res = Http.new(uri: "http://#{host}:#{port}/version", network: opts['network']).get
|
309
|
+
return true if res.status == 200
|
310
|
+
raise "The node #{host}:#{port} is not responding, #{res.status}:#{res.status_line}" unless opts['ignore-ping']
|
311
|
+
@log.error("The node #{host}:#{port} is not responding, #{res.status}:#{res.status_line}")
|
312
|
+
false
|
313
|
+
end
|
307
314
|
end
|
308
315
|
end
|
@@ -43,7 +43,7 @@ module Zold
|
|
43
43
|
def exec(_ = 0)
|
44
44
|
sleep(60) unless @opts['routine-immediately']
|
45
45
|
cmd = Remote.new(remotes: @remotes, log: @log, farm: @farm)
|
46
|
-
args = ['remote', "--network=#{@opts['network']}"]
|
46
|
+
args = ['remote', "--network=#{@opts['network']}", '--ignore-ping']
|
47
47
|
score = @farm.best[0]
|
48
48
|
args << "--ignore-node=#{score.host}:#{score.port}" if score
|
49
49
|
cmd.run(args + ['defaults']) unless @opts['routine-immediately']
|
data/lib/zold/node/farm.rb
CHANGED
@@ -99,7 +99,8 @@ module Zold
|
|
99
99
|
"#{t.name}/#{t.status}/#{t.alive? ? 'alive' : 'dead'}"
|
100
100
|
end.join(', '),
|
101
101
|
pipeline: @pipeline.size,
|
102
|
-
best: best.map(&:to_mnemo).join(', ')
|
102
|
+
best: best.map(&:to_mnemo).join(', '),
|
103
|
+
farmer: @farmer.class.name
|
103
104
|
}
|
104
105
|
end
|
105
106
|
|
data/lib/zold/node/front.rb
CHANGED
@@ -206,7 +206,7 @@ in #{Age.new(@start, limit: 1)}")
|
|
206
206
|
memory: settings.zache.get(:memory, lifetime: 5 * 60) do
|
207
207
|
require 'get_process_mem'
|
208
208
|
mem = GetProcessMem.new.bytes.to_i
|
209
|
-
if mem >
|
209
|
+
if mem > 1024 * 1024 * 1024 && !settings.opts['skip-oom']
|
210
210
|
settings.log.error("We are too big in memory (#{Size.new(mem)}), quitting; use --skip-oom to never quit")
|
211
211
|
Front.stop!
|
212
212
|
end
|
data/lib/zold/version.rb
CHANGED
data/test/node/test_front.rb
CHANGED
@@ -286,8 +286,8 @@ class FrontTest < Zold::Test
|
|
286
286
|
FakeNode.new(log: test_log).run(['--threads=1', '--strength=1', '--no-metronome', '--farmer=plain']) do |port|
|
287
287
|
res = Zold::Http.new(uri: URI("http://localhost:#{port}/")).get
|
288
288
|
assert_wait { Zold::Score.parse(res.headers[Zold::Http::SCORE_HEADER]).value > Zold::Front::MIN_SCORE - 1 }
|
289
|
-
sleep(
|
290
|
-
assert_equal_wait(Zold::Front::MIN_SCORE) do
|
289
|
+
sleep(3)
|
290
|
+
assert_equal_wait(Zold::Front::MIN_SCORE, max: 60) do
|
291
291
|
Zold::Score.parse(res.headers[Zold::Http::SCORE_HEADER]).value
|
292
292
|
end
|
293
293
|
end
|
@@ -311,18 +311,13 @@ class FrontTest < Zold::Test
|
|
311
311
|
def test_alias_parameter
|
312
312
|
name = SecureRandom.hex(4)
|
313
313
|
FakeNode.new(log: test_log).run(['--ignore-score-weakness', "--alias=#{name}"]) do |port|
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
response
|
320
|
-
|
321
|
-
name,
|
322
|
-
Zold::JsonPage.new(response.body).to_hash['alias'].to_s,
|
323
|
-
response.body
|
324
|
-
)
|
325
|
-
end
|
314
|
+
uri = URI("http://localhost:#{port}/")
|
315
|
+
response = Zold::Http.new(uri: uri).get
|
316
|
+
assert_match(
|
317
|
+
name,
|
318
|
+
Zold::JsonPage.new(response.body).to_hash['alias'].to_s,
|
319
|
+
response.body
|
320
|
+
)
|
326
321
|
end
|
327
322
|
end
|
328
323
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
@@ -700,7 +700,7 @@ licenses:
|
|
700
700
|
- MIT
|
701
701
|
metadata: {}
|
702
702
|
post_install_message: |-
|
703
|
-
Thanks for installing Zold 0.17.
|
703
|
+
Thanks for installing Zold 0.17.8!
|
704
704
|
Study our White Paper: https://papers.zold.io/wp.pdf
|
705
705
|
Read our blog posts: https://blog.zold.io
|
706
706
|
Try online wallet at: https://wts.zold.io
|