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



103
104
105
# File 'app/models/solid_queue/job/executable.rb', line 103

def discard
  execution&.discard
end

#dispatchObject



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

def dispatch
  if acquire_concurrency_lock then ready
  else
    handle_concurrency_conflict
  end
end

#dispatch_bypassing_concurrency_limitsObject



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

def dispatch_bypassing_concurrency_limits
  ready
end

#finished!Object



82
83
84
85
86
87
88
89
# File 'app/models/solid_queue/job/executable.rb', line 82

def finished!
  if SolidQueue.preserve_finished_jobs?
    # update! rather than touch so the batch tracking callbacks run
    update!(finished_at: Time.current)
  else
    destroy!
  end
end

#finished?Boolean

Returns:

  • (Boolean)


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

def finished?
  finished_at.present?
end

#prepare_for_executionObject



64
65
66
67
68
69
# File 'app/models/solid_queue/job/executable.rb', line 64

def prepare_for_execution
  if due? then dispatch
  else
    schedule
  end
end

#statusObject



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

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