bensheldon/good_job · error · ArgumentError

Performer argument must implement #next

Error message

Performer argument must implement #next

What it means

Error "Performer argument must implement #next" thrown in bensheldon/good_job.

Source

Thrown at lib/good_job/scheduler.rb:57

    cattr_reader :instances, default: Concurrent::Array.new, instance_reader: false

    # Human readable name of the scheduler that includes configuration values.
    # @return [String]
    attr_reader :name

    # Whether to lower the thread priority to a fixed value
    # @return [Boolean]
    attr_accessor :lower_thread_priority

    # @param performer [GoodJob::JobPerformer]
    # @param max_threads [Numeric, nil] number of seconds between polls for jobs
    # @param max_cache [Numeric, nil] maximum number of scheduled jobs to cache in memory
    # @param warm_cache_on_initialize [Boolean] whether to warm the cache immediately, or manually by calling +warm_cache+
    # @param cleanup_interval_seconds [Numeric, nil] number of seconds between cleaning up job records
    # @param cleanup_interval_jobs [Numeric, nil] number of executed jobs between cleaning up job records
    # @param lower_thread_priority [Boolean] whether to lower the thread priority of execution threads
    def initialize(performer, max_threads: nil, max_cache: nil, warm_cache_on_initialize: false, cleanup_interval_seconds: nil, cleanup_interval_jobs: nil, lower_thread_priority: false)
      raise ArgumentError, "Performer argument must implement #next" unless performer.respond_to?(:next)

      @performer = performer

      @max_cache = max_cache || 0
      @executor_options = DEFAULT_EXECUTOR_OPTIONS.dup
      if max_threads.present?
        @executor_options[:max_threads] = max_threads
        @executor_options[:max_queue] = max_threads
      end
      @name = "GoodJob::Scheduler(queues=#{@performer.name} max_threads=#{@executor_options[:max_threads]})"
      @executor_options[:name] = name

      @cleanup_tracker = CleanupTracker.new(cleanup_interval_seconds: cleanup_interval_seconds, cleanup_interval_jobs: cleanup_interval_jobs)
      @executor_options[:name] = name

      self.lower_thread_priority = lower_thread_priority

      create_executor

View on GitHub (pinned to 5fcde48f87)

Solutions

  1. Pass a performer object that responds to #next to GoodJob::Scheduler.
  2. Use an object implementing #next, such as GoodJob::JobPerformer.

Example fix

GoodJob::Scheduler.new(GoodJob::JobPerformer.new('*'))

When it happens

Trigger: Thrown at lib/good_job/scheduler.rb:57 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bensheldon/good_job@5fcde48f87 (2026-08-23). Data as JSON: /api/errors/8e0ce0de607e518a. Report an issue: GitHub.