Exception: Takagi::Errors::ThreadPoolError

Inherits:
TakagiError
  • Object
show all
Defined in:
lib/takagi/errors.rb

Overview

Raised when thread pool operations fail

Instance Attribute Summary

Attributes inherited from TakagiError

#context, #suggestions

Class Method Summary collapse

Methods inherited from TakagiError

#initialize

Constructor Details

This class inherits a constructor from Takagi::Errors::TakagiError

Class Method Details

.already_started(controller_name) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/takagi/errors.rb', line 80

def self.already_started(controller_name)
  new(
    "Thread pool for #{controller_name} is already running",
    context: {
      controller: controller_name,
      action: "Attempted to start thread pool"
    },
    suggestions: [
      "Call shutdown_workers! before restarting",
      "Check workers_running? before calling start_workers!"
    ]
  )
end

.not_started(controller_name) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/takagi/errors.rb', line 94

def self.not_started(controller_name)
  new(
    "Thread pool for #{controller_name} hasn't been started yet",
    context: {
      controller: controller_name,
      action: "Attempted to schedule work"
    },
    suggestions: [
      "Call #{controller_name}.start_workers! first",
      "Or use lazy initialization by calling #{controller_name}.thread_pool"
    ]
  )
end