lib/good_job/adapter.rb in good_job-1.3.0 vs lib/good_job/adapter.rb in good_job-1.3.1
- old
+ new
@@ -41,12 +41,14 @@
@execution_mode = configuration.execution_mode
raise ArgumentError, "execution_mode: must be one of #{EXECUTION_MODES.join(', ')}." unless EXECUTION_MODES.include?(@execution_mode)
if @execution_mode == :async # rubocop:disable Style/GuardClause
@notifier = notifier || GoodJob::Notifier.new
+ @poller = GoodJob::Poller.new(poll_interval: configuration.poll_interval)
@scheduler = scheduler || GoodJob::Scheduler.from_configuration(configuration)
@notifier.recipients << [@scheduler, :create_thread]
+ @poller.recipients << [@scheduler, :create_thread]
end
end
# Enqueues the ActiveJob job to be performed.
# For use by Rails; you should generally not call this directly.
@@ -86,9 +88,10 @@
# Waits for termination by default.
# @param wait [Boolean] Whether to wait for shut down.
# @return [void]
def shutdown(wait: true)
@notifier&.shutdown(wait: wait)
+ @poller&.shutdown(wait: wait)
@scheduler&.shutdown(wait: wait)
end
# Whether in +:async+ execution mode.
def execute_async?