Class: CachedCounter::RetriedJob

Inherits:
Object
  • Object
show all
Defined in:
lib/cached_counter.rb

Instance Method Summary collapse

Constructor Details

#initialize(model_class:, id:, attribute:, method:) ⇒ RetriedJob

Returns a new instance of RetriedJob.



210
211
212
213
214
215
# File 'lib/cached_counter.rb', line 210

def initialize(model_class:, id:, attribute:, method:)
  @model_class = model_class
  @id = id
  @attribute = attribute
  @method = method
end

Instance Method Details

#enqueue!Object



225
226
227
# File 'lib/cached_counter.rb', line 225

def enqueue!
  Delayed::Job.enqueue self
end

#max_attemptsObject



221
222
223
# File 'lib/cached_counter.rb', line 221

def max_attempts
  10
end

#performObject



217
218
219
# File 'lib/cached_counter.rb', line 217

def perform
  CachedCounter.new(model_class: @model_class, id: @id, attribute: @attribute).send(@method)
end