lib/belated/job_wrapper.rb in belated-0.5.4 vs lib/belated/job_wrapper.rb in belated-0.5.5

- old
+ new

@@ -1,18 +1,23 @@ require 'securerandom' require_relative 'logging' class Belated class JobWrapper + include Comparable include Logging attr_accessor :retries, :max_retries, :id, :job, :at def initialize(job:, max_retries: 5, at: nil) self.retries = 0 self.max_retries = max_retries self.id = SecureRandom.uuid self.job = job self.at = at + end + + def <=>(another) + at <=> another.at end # rubocop:disable Lint/RescueException def perform if job.respond_to?(:call)