Class: RoundhouseUi::Backends::SolidQueue::Entry
- Inherits:
-
Object
- Object
- RoundhouseUi::Backends::SolidQueue::Entry
- Defined in:
- lib/roundhouse_ui/backends/solid_queue.rb
Overview
Wraps a Solid Queue execution + its job in the SortedEntry-like interface the views expect (klass / jid / args / item / at / queue / retry / delete).
Instance Method Summary collapse
- #args ⇒ Object
- #at ⇒ Object
-
#delete ⇒ Object
discard removes the job row along with the execution and takes the row lock while it does; destroy drops only the execution, leaving an orphaned solid_queue_jobs row that nothing will ever pick up again.
-
#initialize(execution) ⇒ Entry
constructor
A new instance of Entry.
- #item ⇒ Object
- #jid ⇒ Object
- #klass ⇒ Object
- #queue ⇒ Object
-
#retry ⇒ Object
Guarded at CALL time.
Constructor Details
#initialize(execution) ⇒ Entry
Returns a new instance of Entry.
128 129 130 131 |
# File 'lib/roundhouse_ui/backends/solid_queue.rb', line 128 def initialize(execution) @execution = execution @job = execution.job end |
Instance Method Details
#args ⇒ Object
136 |
# File 'lib/roundhouse_ui/backends/solid_queue.rb', line 136 def args = active_job_args |
#at ⇒ Object
137 |
# File 'lib/roundhouse_ui/backends/solid_queue.rb', line 137 def at = @execution.try(:scheduled_at) || @execution.try(:created_at) |
#delete ⇒ Object
discard removes the job row along with the execution and takes the row lock while it does; destroy drops only the execution, leaving an orphaned solid_queue_jobs row that nothing will ever pick up again.
160 |
# File 'lib/roundhouse_ui/backends/solid_queue.rb', line 160 def delete = @execution.respond_to?(:discard) ? @execution.discard : @execution.destroy |
#item ⇒ Object
139 140 141 142 143 144 145 146 147 |
# File 'lib/roundhouse_ui/backends/solid_queue.rb', line 139 def item err = (@execution.respond_to?(:error) && @execution.error) || {} { "class" => klass, "args" => args, "queue" => queue, "error_class" => err["exception_class"], "error_message" => err["message"], "error_backtrace" => err["backtrace"] } end |
#jid ⇒ Object
133 |
# File 'lib/roundhouse_ui/backends/solid_queue.rb', line 133 def jid = @execution.job_id.to_s |
#klass ⇒ Object
134 |
# File 'lib/roundhouse_ui/backends/solid_queue.rb', line 134 def klass = @job&.class_name |
#queue ⇒ Object
135 |
# File 'lib/roundhouse_ui/backends/solid_queue.rb', line 135 def queue = @job&.queue_name |
#retry ⇒ Object
Guarded at CALL time. As a trailing if on an endless def this was evaluated
when the class body loaded, against a nil class-level ivar — so the method
was never defined and every Retry raised NoMethodError.
152 153 154 155 156 |
# File 'lib/roundhouse_ui/backends/solid_queue.rb', line 152 def retry raise NotImplementedError, "this entry cannot be retried" unless @execution.respond_to?(:retry) @execution.retry end |