{"record":{"id":"17ffd29ae28e650a","repo":"bensheldon/good_job","slug":"scheduler-restart-cannot-be-called-with-a-timeout","errorCode":null,"errorMessage":"Scheduler#restart cannot be called with a timeout of nil","messagePattern":"Scheduler#restart cannot be called with a timeout of nil","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/good_job/scheduler.rb","lineNumber":125,"sourceCode":"        end\n\n        if executor.shuttingdown? && timeout\n          executor_wait = timeout.negative? ? nil : timeout\n          return if executor.wait_for_termination(executor_wait)\n\n          instrument(\"scheduler_shutdown_kill\", { active_job_ids: @performer.performing_active_job_ids.to_a })\n          executor.kill\n          executor.wait_for_termination\n        end\n      end\n    end\n\n    # Restart the Scheduler.\n    # When shutdown, start; or shutdown and start.\n    # @param timeout [Numeric] Seconds to wait for actively executing jobs to finish; shares same values as {#shutdown}.\n    # @return [void]\n    def restart(timeout: -1)\n      raise ArgumentError, \"Scheduler#restart cannot be called with a timeout of nil\" if timeout.nil?\n\n      instrument(\"scheduler_restart_pools\") do\n        shutdown(timeout: timeout)\n        @performer.reset_stats\n        create_executor\n        warm_cache\n      end\n    end\n\n    # Wakes a thread to allow the performer to execute a task.\n    # @param state [Hash, nil] Contextual information for the performer. See {JobPerformer#next?}.\n    # @return [Boolean, nil] Whether work was started.\n    #   * +nil+ if the scheduler is unable to take new work, for example if the thread pool is shut down or at capacity.\n    #   * +true+ if the performer started executing work.\n    #   * +false+ if the performer decides not to attempt to execute a task based on the +state+ that is passed to it.\n    def create_thread(state = nil)\n      return nil unless executor.running?\n","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/bensheldon/good_job/blob/5fcde48f8765e69901ffa9c5a06122b19c73875f/lib/good_job/scheduler.rb#L107-L143","documentation":"Error \"Scheduler#restart cannot be called with a timeout of nil\" thrown in bensheldon/good_job.","triggerScenarios":"Thrown at lib/good_job/scheduler.rb:125 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a numeric timeout when calling Scheduler#restart.","Call restart with a timeout value in seconds."],"exampleFix":"scheduler.restart(timeout: 5)","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5fcde48f8765e69901ffa9c5a06122b19c73875f","analyzedAt":"2026-08-23T14:55:11.399Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}