mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 15:05:24 +08:00
FEATURE: admin dashboard check when email polling errored in the past 24 hours
This commit is contained in:
parent
dcb31fa6c1
commit
162fcb75da
|
@ -80,6 +80,7 @@ module Jobs
|
|||
|
||||
client_message
|
||||
else
|
||||
mark_as_errored!
|
||||
Discourse.handle_job_exception(e, error_context(@args, "Unrecognized error type when processing incoming email", mail: mail_string))
|
||||
end
|
||||
end
|
||||
|
@ -94,8 +95,21 @@ module Jobs
|
|||
end
|
||||
end
|
||||
rescue Net::POPAuthenticationError => e
|
||||
mark_as_errored!
|
||||
Discourse.handle_job_exception(e, error_context(@args, "Signing in to poll incoming email"))
|
||||
end
|
||||
|
||||
POLL_MAILBOX_ERRORS_KEY ||= "poll_mailbox_errors".freeze
|
||||
|
||||
def self.errors_in_past_24_hours
|
||||
$redis.zremrangebyscore(POLL_MAILBOX_ERRORS_KEY, 0, 24.hours.ago.to_i)
|
||||
$redis.zcard(POLL_MAILBOX_ERRORS_KEY).to_i
|
||||
end
|
||||
|
||||
def mark_as_errored!
|
||||
now = Time.now.to_i
|
||||
$redis.zadd(POLL_MAILBOX_ERRORS_KEY, now, now.to_s)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -63,7 +63,7 @@ class AdminDashboardData
|
|||
:send_consumer_email_check, :title_check,
|
||||
:site_description_check, :site_contact_username_check,
|
||||
:notification_email_check, :subfolder_ends_in_slash_check,
|
||||
:pop3_polling_configuration
|
||||
:pop3_polling_configuration, :email_polling_errored_recently
|
||||
|
||||
add_problem_check do
|
||||
sidekiq_check || queue_size_check
|
||||
|
@ -210,4 +210,9 @@ class AdminDashboardData
|
|||
POP3PollingEnabledSettingValidator.new.error_message if SiteSetting.pop3_polling_enabled
|
||||
end
|
||||
|
||||
def email_polling_errored_recently
|
||||
errors = Jobs::PollMailbox.errors_in_past_24_hours
|
||||
I18n.t('dashboard.email_polling_errored_recently', count: errors) if errors > 0
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -781,6 +781,9 @@ en:
|
|||
site_contact_username_warning: "Enter the name of a friendly staff user account to send important automated messages from. Update site_contact_username in <a href='/admin/site_settings'>Site Settings</a>."
|
||||
notification_email_warning: "Notification emails are not being sent from a valid email address on your domain; email delivery will be erratic and unreliable. Please set notification_email to a valid local email address in <a href='/admin/site_settings'>Site Settings</a>."
|
||||
subfolder_ends_in_slash: "Your subfolder setup is incorrect; the DISCOURSE_RELATIVE_URL_ROOT ends in a slash."
|
||||
email_polling_errored_recently:
|
||||
one: "Email polling has generated an error in the past 24 hours. Look at <a href='/logs' target='_blank'>the logs</a> for more details."
|
||||
other: "Email polling has generated %{count} errors in the past 24 hours. Look at <a href='/logs' target='_blank'>the logs</a> for more details."
|
||||
|
||||
site_settings:
|
||||
censored_words: "Words that will be automatically replaced with ■■■■"
|
||||
|
|
Loading…
Reference in New Issue
Block a user