Method: Exekutor::Internal::Reserver#get_abandoned_jobs

Defined in:
lib/exekutor/internal/reserver.rb

#get_abandoned_jobs(active_job_ids) ⇒ Array<Hash>

Gets the jobs that are assigned to this worker and have an id that is not included in active_job_ids

Parameters:

  • active_job_ids (Array<String>)

    The ids of the jobs that should be excluded

Returns:

  • (Array<Hash>)

    the jobs



43
44
45
46
47
48
# File 'lib/exekutor/internal/reserver.rb', line 43

def get_abandoned_jobs(active_job_ids)
  jobs = Exekutor::Job.executing.where(worker_id: @worker_id)
  jobs = jobs.where.not(id: active_job_ids) if active_job_ids.present?
  attrs = %i[id payload options scheduled_at]
  jobs.pluck(*attrs).map { |p| attrs.zip(p).to_h }
end