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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e102a5d92bc1bde5c3751cf9c7737f64b751b7240596028b5e3488c59fbd6e9f
4
- data.tar.gz: 65ea0826b5dfe6a693142356174dd808525f1ba23668f643beb341add7edb2c1
3
+ metadata.gz: 3f0679dc1e88e4dd4f80ef8e5a9060be971b4b681dc098d5bbb70210511dbe67
4
+ data.tar.gz: 0b880093309c1797f862fd3af1041deb13283f0bbfe4a2f479aaafd0908063ae
5
5
  SHA512:
6
- metadata.gz: ffe60b65ba93cb1dd80c3257d7dabd9d808019b57b32fa51ebf97deca31d5f3ecfe6d5fd1a3af31a8ae64a39e3c90611c03d2f530e951951bcf2bb9629cc8826
7
- data.tar.gz: d19ae042b08b72c357d23438f65fabebe4a46ee3fcf536a79e231f739809fb2c0589b885621473e4b53eee68c33b703df81a64e0882a19447d3b1ee0762a66b8
6
+ metadata.gz: 139d5ce8724342ea38b1b5ff6d8455f0cba5dddfe37448e5809e6af0516f92788d103c57968d758b960e41a8276ab6da56907c6cf309ef4c1ef29ecb4a1bc1e8
7
+ data.tar.gz: e699b26769b0a71d0c8f1366ce90f17f6693aa8687975dc7aca882630c2e4f37d3bf8f5e53a8b3c44367a14a12a6678b47a41bfdf5f54c287816e822c6298baa
data/Gemfile CHANGED
@@ -21,4 +21,5 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  source 'https://rubygems.org'
24
+ ruby '2.5.1'
24
25
  gemspec
@@ -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 { Process.kill('KILL', pid) }
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
@@ -25,6 +25,6 @@
25
25
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.17.0'
28
+ VERSION = '0.17.1'
29
29
  PROTOCOL = 2
30
30
  end
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.0
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.0!
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