zold 0.17.0 → 0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/lib/zold/node/farmers.rb +11 -12
- data/lib/zold/version.rb +1 -1
- 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: 3f0679dc1e88e4dd4f80ef8e5a9060be971b4b681dc098d5bbb70210511dbe67
|
4
|
+
data.tar.gz: 0b880093309c1797f862fd3af1041deb13283f0bbfe4a2f479aaafd0908063ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 139d5ce8724342ea38b1b5ff6d8455f0cba5dddfe37448e5809e6af0516f92788d103c57968d758b960e41a8276ab6da56907c6cf309ef4c1ef29ecb4a1bc1e8
|
7
|
+
data.tar.gz: e699b26769b0a71d0c8f1366ce90f17f6693aa8687975dc7aca882630c2e4f37d3bf8f5e53a8b3c44367a14a12a6678b47a41bfdf5f54c287816e822c6298baa
|
data/Gemfile
CHANGED
data/lib/zold/node/farmers.rb
CHANGED
@@ -35,6 +35,14 @@ require_relative '../age'
|
|
35
35
|
module Zold
|
36
36
|
# Farmer
|
37
37
|
module Farmers
|
38
|
+
# Kill a process
|
39
|
+
def self.kill(log, pid, start)
|
40
|
+
Process.kill('KILL', pid)
|
41
|
+
log.debug("Process ##{pid} killed after #{Age.new(start)} of activity")
|
42
|
+
rescue StandardError => e
|
43
|
+
log.debug("No need to kill process ##{pid} since it's dead already: #{e.message}")
|
44
|
+
end
|
45
|
+
|
38
46
|
# Plain and simple
|
39
47
|
class Plain
|
40
48
|
def initialize(log: Log::NULL)
|
@@ -71,7 +79,7 @@ module Zold
|
|
71
79
|
].join(' ')
|
72
80
|
Open3.popen2e(cmd) do |stdin, stdout, thr|
|
73
81
|
Thread.current.thread_variable_set(:pid, thr.pid.to_s)
|
74
|
-
at_exit { kill(thr.pid, start) }
|
82
|
+
at_exit { Farmers.kill(@log, thr.pid, start) }
|
75
83
|
@log.debug("Scoring started in proc ##{thr.pid} \
|
76
84
|
for #{score.value}/#{score.strength} at #{score.host}:#{score.port}")
|
77
85
|
begin
|
@@ -101,19 +109,10 @@ for #{score.value}/#{score.strength} at #{score.host}:#{score.port}")
|
|
101
109
|
for #{after.host}:#{after.port} in #{Age.new(start)}: #{after.suffixes}")
|
102
110
|
after
|
103
111
|
ensure
|
104
|
-
kill(thr.pid, start)
|
112
|
+
Farmers.kill(@log, thr.pid, start)
|
105
113
|
end
|
106
114
|
end
|
107
115
|
end
|
108
|
-
|
109
|
-
private
|
110
|
-
|
111
|
-
def kill(pid, start)
|
112
|
-
Process.kill('KILL', pid)
|
113
|
-
@log.debug("Process ##{pid} killed after #{Age.new(start)} of activity")
|
114
|
-
rescue StandardError => e
|
115
|
-
@log.debug("No need to kill process ##{pid} since it's dead already: #{e.message}")
|
116
|
-
end
|
117
116
|
end
|
118
117
|
|
119
118
|
# In a child process using fork
|
@@ -128,7 +127,7 @@ for #{after.host}:#{after.port} in #{Age.new(start)}: #{after.suffixes}")
|
|
128
127
|
pid = Process.fork do
|
129
128
|
stdout.puts(score.next)
|
130
129
|
end
|
131
|
-
at_exit {
|
130
|
+
at_exit { Farmers.kill(@log, pid, start) }
|
132
131
|
Process.wait
|
133
132
|
stdout.close
|
134
133
|
after = Score.parse(stdin.read.strip)
|
data/lib/zold/version.rb
CHANGED
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
@@ -711,7 +711,7 @@ licenses:
|
|
711
711
|
- MIT
|
712
712
|
metadata: {}
|
713
713
|
post_install_message: |-
|
714
|
-
Thanks for installing Zold 0.17.
|
714
|
+
Thanks for installing Zold 0.17.1!
|
715
715
|
Study our White Paper: https://papers.zold.io/wp.pdf
|
716
716
|
Read our blog posts: https://blog.zold.io
|
717
717
|
Try online wallet at: https://wts.zold.io
|