Show a warning if there are email jobs in the retry queue

This commit is contained in:
Neil Lalonde 2013-04-22 13:37:16 -04:00
parent ae487e740c
commit 439877bdb9
3 changed files with 19 additions and 1 deletions

View File

@ -40,7 +40,15 @@ class AdminDashboardData
end
def problems
[rails_env_check, host_names_check, gc_checks, sidekiq_check || queue_size_check || clockwork_check, ram_check, facebook_config_check, twitter_config_check, github_config_check].compact
[ rails_env_check,
host_names_check,
gc_checks,
sidekiq_check || queue_size_check || clockwork_check,
ram_check,
facebook_config_check,
twitter_config_check,
github_config_check,
failing_emails_check ].compact
end
def rails_env_check
@ -84,4 +92,9 @@ class AdminDashboardData
def github_config_check
I18n.t('dashboard.github_config_warning') if SiteSetting.enable_github_logins and (!SiteSetting.github_client_id.present? or !SiteSetting.github_client_secret.present?)
end
def failing_emails_check
num_failed_jobs = Jobs.num_email_retry_jobs
I18n.t('dashboard.failing_emails_warning', num_failed_jobs: num_failed_jobs) if num_failed_jobs > 0
end
end

View File

@ -346,6 +346,7 @@ en:
facebook_config_warning: 'The server is configured to allow signup and log in with Facebook (enable_facebook_logins), but the app id and app secret values are not set. Go to <a href="/admin/site_settings">the Site Settings</a> and update the settings. <a href="https://github.com/discourse/discourse/wiki/The-Discourse-Admin-Quick-Start-Guide#enable-facebook-logins" target="_blank">See this guide to learn more</a>.'
twitter_config_warning: 'The server is configured to allow signup and log in with Twitter (enable_twitter_logins), but the key and secret values are not set. Go to <a href="/admin/site_settings">the Site Settings</a> and update the settings. <a href="https://github.com/discourse/discourse/wiki/The-Discourse-Admin-Quick-Start-Guide#enable-twitter-logins" target="_blank">See this guide to learn more</a>.'
github_config_warning: 'The server is configured to allow signup and log in with GitHub (enable_github_logins), but the client id and secret values are not set. Go to <a href="/admin/site_settings">the Site Settings</a> and update the settings. <a href="https://github.com/discourse/discourse/wiki/The-Discourse-Admin-Quick-Start-Guide" target="_blank">See this guide to learn more</a>.'
failing_emails_warning: "There are %{num_failed_jobs} email jobs that failed. Check your config/production.rb file and ensure that the config.action_mailer settings are correct."
content_types:
education_new_reply:

View File

@ -11,6 +11,10 @@ module Jobs
end
end
def self.num_email_retry_jobs
Sidekiq::RetrySet.new.select { |job| job.klass =~ /Email$/ }.size
end
class Base
include Sidekiq::Worker