Class: SidekiqBatchJob

Inherits:
Object
  • Object
show all
Extended by:
Sidekiq::Batch::Jobs::EnumCompat
Defined in:
app/models/sidekiq_batch_job.rb

Overview

Schema Information

Table name: sidekiq_batch_jobs

id :bigint not null, primary key args :jsonb not null error_class :string error_message :text jid :string not null status :integer default("pending"), not null worker_class :string not null created_at :datetime not null updated_at :datetime not null sidekiq_batch_id :bigint not null

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Sidekiq::Batch::Jobs::EnumCompat

status_enum

Class Method Details

.batch_ids_active_since(cutoff) ⇒ Object



40
41
42
# File 'app/models/sidekiq_batch_job.rb', line 40

def batch_ids_active_since(cutoff)
  where(updated_at: cutoff..).select(:sidekiq_batch_id)
end

.complete!(jid) ⇒ Object



32
33
34
# File 'app/models/sidekiq_batch_job.rb', line 32

def complete!(jid)
  transition(jid, "complete")
end

.fail!(jid, error) ⇒ Object



36
37
38
# File 'app/models/sidekiq_batch_job.rb', line 36

def fail!(jid, error)
  transition(jid, "failed", error_attributes(error))
end

Instance Method Details

#mark_complete!Object



60
61
62
# File 'app/models/sidekiq_batch_job.rb', line 60

def mark_complete!
  self.class.complete!(jid)
end

#mark_failed!(error) ⇒ Object



64
65
66
# File 'app/models/sidekiq_batch_job.rb', line 64

def mark_failed!(error)
  self.class.fail!(jid, error)
end