lib/good_job/poller.rb in good_job-3.15.14 vs lib/good_job/poller.rb in good_job-3.16.0
- old
+ new
@@ -1,6 +1,7 @@
# frozen_string_literal: true
+
require 'concurrent/atomic/atomic_boolean'
module GoodJob # :nodoc:
#
# Pollers regularly wake up execution threads to check for new work.
@@ -15,11 +16,11 @@
# @!attribute [r] instances
# @!scope class
# List of all instantiated Pollers in the current process.
# @return [Array<GoodJob::Poller>, nil]
- cattr_reader :instances, default: [], instance_reader: false
+ cattr_reader :instances, default: Concurrent::Array.new, instance_reader: false
# Creates GoodJob::Poller from a GoodJob::Configuration instance.
# @param configuration [GoodJob::Configuration]
# @return [GoodJob::Poller]
def self.from_configuration(configuration)
@@ -36,12 +37,11 @@
@recipients = Concurrent::Array.new(recipients)
@timer_options = DEFAULT_TIMER_OPTIONS.dup
@timer_options[:execution_interval] = poll_interval if poll_interval.present?
- self.class.instances << self
-
create_timer
+ self.class.instances << self
end
# Tests whether the timer is running.
# @return [true, false, nil]
delegate :running?, to: :timer, allow_nil: true