method

deserialize

Importance_1
v5.0.0.1 - Show latest stable - 0 notes - Class: Core
deserialize(job_data) public

Attaches the stored job data to the current instance. Receives a hash returned from serialize

Examples

class DeliverWebhookJob < ActiveJob::Base
  def serialize
    super.merge('attempt_number' => (@attempt_number || 0) + 1)
  end

  def deserialize(job_data)
    super
    @attempt_number = job_data['attempt_number']
  end

  rescue_from(TimeoutError) do |exception|
    raise exception if @attempt_number > 5
    retry_job(wait: 10)
  end
end
Show source
Register or log in to add new notes.