Sha256: 5f90d00c69194bde53fa30e5c0a05735ee10908b5e5fe98f7f5ac23c33ed7a25
Contents?: true
Size: 971 Bytes
Versions: 23
Compression:
Stored size: 971 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_with_exception # # 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
23 entries across 23 versions & 1 rubygems