mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: admin dashboard check when email polling errored in the past 24 hours
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user