lib/good_job/notifier.rb in good_job-3.25.0 vs lib/good_job/notifier.rb in good_job-3.26.0
- old
+ new
@@ -91,22 +91,22 @@
# @return [true, false, nil]
def connected?(timeout: nil)
if timeout.nil?
@connected.set?
else
- @connected.wait(timeout == -1 ? nil : timeout)
+ @connected.wait(timeout&.negative? ? nil : timeout)
end
end
# Tests whether the notifier is listening for new messages.
# @param timeout [Numeric, nil] Seconds to wait for condition to be true, -1 is forever
# @return [true, false, nil]
def listening?(timeout: nil)
if timeout.nil?
@listening.set?
else
- @listening.wait(timeout == -1 ? nil : timeout)
+ @listening.wait(timeout&.negative? ? nil : timeout)
end
end
def shutdown?
@shutdown_event.set?
@@ -128,10 +128,10 @@
# clean up in the even the executor is killed
@connected.reset
@listening.reset
@shutdown_event.set
else
- @shutdown_event.wait(timeout == -1 ? nil : timeout) unless timeout.nil?
+ @shutdown_event.wait(timeout&.negative? ? nil : timeout) unless timeout.nil?
@connected.reset if @shutdown_event.set?
end
@shutdown_event.set?
end
end