debian-mirror-gitlab/lib/gitlab/sidekiq_middleware/duplicate_jobs/strategies/base.rb

38 lines
827 B
Ruby
Raw Normal View History

2021-01-29 00:20:46 +05:30
# frozen_string_literal: true
module Gitlab
module SidekiqMiddleware
module DuplicateJobs
module Strategies
class Base
def initialize(duplicate_job)
@duplicate_job = duplicate_job
end
def schedule(job)
raise NotImplementedError
end
def perform(_job)
raise NotImplementedError
end
private
attr_reader :duplicate_job
def strategy_name
self.class.name.to_s.demodulize.underscore.humanize.downcase
end
def check!
2021-12-11 22:18:48 +05:30
# The default expiry time is the worker class'
# configured deduplication TTL or DuplicateJob::DEFAULT_DUPLICATE_KEY_TTL.
2021-01-29 00:20:46 +05:30
duplicate_job.check!
end
end
end
end
end
end