{"record":{"id":"f77b7311c1fce3d1","repo":"bensheldon/good_job","slug":"capsule-restart-cannot-be-called-with-a-timeout-of","errorCode":null,"errorMessage":"Capsule#restart cannot be called with a timeout of nil","messagePattern":"Capsule#restart cannot be called with a timeout of nil","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/good_job/capsule.rb","lineNumber":72,"sourceCode":"    # Shut down the thread pool executors.\n    # @param timeout [nil, Numeric, NONE] Seconds to wait for active threads.\n    #   * +-1+ will wait for all active threads to complete.\n    #   * +0+ will interrupt active threads.\n    #   * +N+ will wait at most N seconds and then interrupt active threads.\n    #   * +nil+ will trigger a shutdown but not wait for it to complete.\n    # @return [void]\n    def shutdown(timeout: NONE)\n      timeout = configuration.shutdown_timeout if timeout == NONE\n      GoodJob._shutdown_all([@notifier, @poller, @multi_scheduler, @cron_manager].compact, after: [@shared_executor], timeout: timeout)\n      @startable = false\n      @started_at = nil\n    end\n\n    # Shutdown and then start the capsule again.\n    # @param timeout [Numeric, NONE] Seconds to wait for active threads.\n    # @return [void]\n    def restart(timeout: NONE)\n      raise ArgumentError, \"Capsule#restart cannot be called with a timeout of nil\" if timeout.nil?\n\n      shutdown(timeout: timeout)\n      start(force: true)\n    end\n\n    # @return [Boolean] Whether the capsule is currently running.\n    def running?\n      @started_at.present?\n    end\n\n    # @return [Boolean] Whether the capsule has been shutdown.\n    def shutdown?\n      [@notifier, @poller, @multi_scheduler, @cron_manager].compact.all?(&:shutdown?)\n    end\n\n    # @param duration [nil, Numeric] Length of idleness to check for (in seconds).\n    # @return [Boolean] Whether the capsule is idle\n    def idle?(duration = nil)","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/bensheldon/good_job/blob/5fcde48f8765e69901ffa9c5a06122b19c73875f/lib/good_job/capsule.rb#L54-L90","documentation":"Error \"Capsule#restart cannot be called with a timeout of nil\" thrown in bensheldon/good_job.","triggerScenarios":"Thrown at lib/good_job/capsule.rb:72 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a numeric timeout when calling Capsule#restart.","Call restart with a timeout value in seconds."],"exampleFix":"capsule.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"}