lib/zold/node/async_entrance.rb in zold-0.16.27 vs lib/zold/node/async_entrance.rb in zold-0.16.28
- old
+ new
@@ -34,11 +34,11 @@
# Copyright:: Copyright (c) 2018 Yegor Bugayenko
# License:: MIT
module Zold
# The entrance
class AsyncEntrance
- def initialize(entrance, dir, log: Log::Quiet.new, threads: [Concurrent.processor_count, 4].max)
+ def initialize(entrance, dir, log: Log::NULL, threads: [Concurrent.processor_count, 4].max)
@entrance = entrance
@dir = File.expand_path(dir)
@log = log
@total = threads
@queue = Queue.new
@@ -101,9 +101,9 @@
Thread.current.thread_variable_set(:wallet, item[:id].to_s)
body = IO.read(item[:file])
FileUtils.rm_f(item[:file])
@entrance.push(item[:id], body)
@log.debug("Pushed #{item[:id]}/#{Size.new(body.length)} to #{@entrance.class.name} \
-in #{Age.new(start, limit: 0.1)} (#{@queue.size} still in the queue)")
+in #{Age.new(start, limit: 0.1)}#{@queue.size.zero? ? '' : "(#{@queue.size} still in the queue)"}")
end
end
end