Module: SolidQueue::Job::Executable

Extended by:
ActiveSupport::Concern
Included in:
SolidQueue::Job
Defined in:
app/models/solid_queue/job/executable.rb

Instance Method Summary collapse

Instance Method Details

#discardObject



98
99
100
# File 'app/models/solid_queue/job/executable.rb', line 98

def discard
  execution&.discard
end

#dispatchObject



67
68
69
70
71
72
# File 'app/models/solid_queue/job/executable.rb', line 67

def dispatch
  if acquire_concurrency_lock then ready
  else
    block
  end
end

#dispatch_bypassing_concurrency_limitsObject



74
75
76
# File 'app/models/solid_queue/job/executable.rb', line 74

def dispatch_bypassing_concurrency_limits
  ready
end

#finished!Object



78
79
80
81
82
83
84
# File 'app/models/solid_queue/job/executable.rb', line 78

def finished!
  if SolidQueue.preserve_finished_jobs?
    touch(:finished_at)
  else
    destroy!
  end
end

#finished?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'app/models/solid_queue/job/executable.rb', line 86

def finished?
  finished_at.present?
end

#prepare_for_executionObject



60
61
62
63
64
65
# File 'app/models/solid_queue/job/executable.rb', line 60

def prepare_for_execution
  if due? then dispatch
  else
    schedule
  end
end

#statusObject



90
91
92
93
94
95
96
# File 'app/models/solid_queue/job/executable.rb', line 90

def status
  if finished?
    :finished
  elsif execution.present?
    execution.type
  end
end