lib/zold/node/async_entrance.rb in zold-0.16.4 vs lib/zold/node/async_entrance.rb in zold-0.16.5
- old
+ new
@@ -72,11 +72,11 @@
@pool.post do
Thread.current.name = "async-e##{t}"
loop do
VerboseThread.new(@log).run(true) { take }
break if @pool.shuttingdown?
- sleep Random.rand(100) / 100
+ sleep(1 + Random.rand(100) / 100)
end
end
end
begin
yield(self)
@@ -117,9 +117,10 @@
def take
start = Time.now
opts = queue
return if opts.empty?
id = opts[0]
+ Thread.current.thread_variable_set(:wallet, id.to_s)
body = Futex.new(file(id), log: @log).open do |f|
b = File.exist?(f) ? IO.read(f) : ''
FileUtils.rm_f(f)
b
end