sidekiq_process_check.rb 583 B

123456789101112131415161718192021222324252627282930
  1. # frozen_string_literal: true
  2. class Admin::SystemCheck::SidekiqProcessCheck < Admin::SystemCheck::BaseCheck
  3. SIDEKIQ_QUEUES = %w(
  4. default
  5. push
  6. mailers
  7. pull
  8. scheduler
  9. ingress
  10. ).freeze
  11. def skip?
  12. !current_user.can?(:view_devops)
  13. end
  14. def pass?
  15. missing_queues.empty?
  16. end
  17. def message
  18. Admin::SystemCheck::Message.new(:sidekiq_process_check, missing_queues.join(', '))
  19. end
  20. private
  21. def missing_queues
  22. @missing_queues ||= Sidekiq::ProcessSet.new.reduce(SIDEKIQ_QUEUES) { |queues, process| queues - process['queues'] }
  23. end
  24. end