This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2021-04-03 05:12:30 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Admin::SystemCheck::SidekiqProcessCheck < Admin::SystemCheck::BaseCheck
|
|
|
|
SIDEKIQ_QUEUES = %w(
|
|
|
|
default
|
|
|
|
push
|
|
|
|
mailers
|
|
|
|
pull
|
|
|
|
scheduler
|
2022-11-10 05:21:51 -08:00
|
|
|
ingress
|
2021-04-03 05:12:30 -07:00
|
|
|
).freeze
|
|
|
|
|
2022-07-04 17:41:40 -07:00
|
|
|
def skip?
|
|
|
|
!current_user.can?(:view_devops)
|
|
|
|
end
|
|
|
|
|
2021-04-03 05:12:30 -07:00
|
|
|
def pass?
|
|
|
|
missing_queues.empty?
|
|
|
|
end
|
|
|
|
|
|
|
|
def message
|
|
|
|
Admin::SystemCheck::Message.new(:sidekiq_process_check, missing_queues.join(', '))
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def missing_queues
|
|
|
|
@missing_queues ||= Sidekiq::ProcessSet.new.reduce(SIDEKIQ_QUEUES) { |queues, process| queues - process['queues'] }
|
|
|
|
end
|
|
|
|
end
|