Add warning in admin dashboard if some required queues are not handled (#15954)

master
Claire 4 years ago committed by GitHub
parent dd1eb9918a
commit 59f94593d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/controllers/admin/dashboard_controller.rb
  2. 1
      config/locales/en.yml

@ -3,7 +3,13 @@ require 'sidekiq/api'
module Admin module Admin
class DashboardController < BaseController class DashboardController < BaseController
SIDEKIQ_QUEUES = %w(default push mailers pull scheduler).freeze
def index def index
missing_queues = Sidekiq::ProcessSet.new.reduce(SIDEKIQ_QUEUES) { |queues, process| queues - process['queues'] }
flash.now[:alert] = I18n.t('admin.dashboard.misconfigured_sidekiq_alert', queues: missing_queues.join(', ')) unless missing_queues.empty?
@users_count = User.count @users_count = User.count
@pending_users_count = User.pending.count @pending_users_count = User.pending.count
@registrations_week = Redis.current.get("activity:accounts:local:#{current_week}") || 0 @registrations_week = Redis.current.get("activity:accounts:local:#{current_week}") || 0

@ -367,6 +367,7 @@ en:
feature_timeline_preview: Timeline preview feature_timeline_preview: Timeline preview
features: Features features: Features
hidden_service: Federation with hidden services hidden_service: Federation with hidden services
misconfigured_sidekiq_alert: 'No Sidekiq process seems to be handling the following queues: %{queues}. Please review your Sidekiq configuration.'
open_reports: open reports open_reports: open reports
pending_tags: hashtags waiting for review pending_tags: hashtags waiting for review
pending_users: users waiting for review pending_users: users waiting for review

Loading…
Cancel
Save