sidekiq_process_check.rb 571 B

1234567891011121314151617181920212223242526272829
  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. ).freeze
  10. def skip?
  11. !current_user.can?(:view_devops)
  12. end
  13. def pass?
  14. missing_queues.empty?
  15. end
  16. def message
  17. Admin::SystemCheck::Message.new(:sidekiq_process_check, missing_queues.join(', '))
  18. end
  19. private
  20. def missing_queues
  21. @missing_queues ||= Sidekiq::ProcessSet.new.reduce(SIDEKIQ_QUEUES) { |queues, process| queues - process['queues'] }
  22. end
  23. end