Sha256: ee1784e06f0ea1dd782ce373f30d0a9abee5bf03bbfaa97a62b804338bd3b80f
Contents?: true
Size: 956 Bytes
Versions: 10
Compression:
Stored size: 956 Bytes
Contents
# frozen_string_literal: true module Delayed module Jobs # # Capture a specific worker process # class Worker include StandardModel include ServerProcessAble # # Relationships # has_many :runs, class_name: 'Delayed::Jobs::Run', dependent: :restrict # # Record a job relative to the worker # def record_job(job) stop runs.create!(name: job.display_name, locked_at: job.locked_at, locked_by: job.locked_by) end # # Is this worker dead?, meaning has it reported in a timely manner # def dead? last_check_in_at.present? ? check_in_limit > last_check_in_at : false rescue StandardError true end private # # Return the check in time limit based on if we are running or not # def check_in_limit running? ? 3.hour.ago.utc : 1.minute.ago.utc end end end end
Version data entries
10 entries across 10 versions & 1 rubygems