модуль ActiveJob::Continuable
Active Job Continuable
Модуль Continuable позволяет отслеживать ход выполнения заданий и продолжать их с того места, где они были прерваны.
Подключите ActiveJob::Continuable к заданию, чтобы включить продолжения.
Инструкции по использованию см. в разделе ActiveJob::Continuation.
Атрибуты
Количество возобновлений задания.
Публичные методы класса
# File activejob/lib/active_job/continuable.rb, line 23
def initialize(...)
super(...)
self.resumptions = 0
self.continuation = Continuation.new(self, {})
end Вызывает метод суперкласса
Публичные методы экземпляра
# File activejob/lib/active_job/continuable.rb, line 36
def step(step_name, start: nil, isolated: false, &block)
unless block_given?
step_method = method(step_name)
raise ArgumentError, "Step method '#{step_name}' must accept 0 or 1 arguments" if step_method.arity > 1
if step_method.parameters.any? { |type, name| type == :key || type == :keyreq }
raise ArgumentError, "Step method '#{step_name}' must not accept keyword arguments"
end
block = step_method.arity == 0 ? -> (_) { step_method.call } : step_method
end
checkpoint! if continuation.advanced?
continuation.step(step_name, start: start, isolated: isolated, &block)
end Начинает новый шаг продолжения
© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.