lib/judges/commands/pull.rb in judges-0.17.0 vs lib/judges/commands/pull.rb in judges-0.18.0

- old
+ new

@@ -47,28 +47,29 @@ ) name = args[0] elapsed(@loog) do if baza.name_exists?(name) baza.lock(name, opts['owner']) - fb.import(baza.pull(wait(baza, baza.recent(name), opts['wait']))) + fb.import(baza.pull(wait(name, baza, baza.recent(name), opts['wait']))) Judges::Impex.new(@loog, args[1]).export(fb) throw :"Pulled #{fb.size} facts by the name '#{name}'" else throw :"There is nothing to pull, the name '#{name}' is absent on the server" end end end private - def wait(baza, id, limit) + def wait(name, baza, id, limit) raise 'Waiting time is nil' if limit.nil? start = Time.now loop do break if baza.finished?(id) sleep 1 - raise 'Time is over, the job is still not finished' if Time.now - start > limit - @loog.debug("Still waiting for the job ##{id} to finish... (#{format('%.2f', Time.now - start)}s already)") + raise "Time is over, the job ##{id} ('#{name}') is still not finished" if Time.now - start > limit + lapsed = Time.now - start + @loog.debug("Still waiting for the job ##{id} ('#{name}') to finish... (#{format('%.2f', lapsed)}s already)") end id end end