lib/parallel_minion/minion.rb in parallel_minion-0.3.0 vs lib/parallel_minion/minion.rb in parallel_minion-0.4.0
- old
+ new
@@ -182,10 +182,15 @@
# Note: The result of any thread cannot be nil
def result
# Return nil if Minion is still working and has time left to finish
if working?
ms = time_left
- return if @thread.join(ms.nil? ? nil: ms / 1000).nil?
+ logger.benchmark_info("Waited for Minion to complete: #{@description}", min_duration: 0.01) do
+ if @thread.join(ms.nil? ? nil: ms / 1000).nil?
+ logger.warn("Timed out waiting for result from Minion: #{@description}")
+ return
+ end
+ end
end
# Return the exception, if any, otherwise the task result
exception.nil? ? @result : Kernel.raise(exception)
end