mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:16:38 -06:00
DEV: Add the ability for problem checks to specify 'max blips' (#26388)
This was originally introduced in #26071, but that PR was closed, because the requirements changed. This PR lifts only the relevant parts, since they are a prerequisite for the new admin notice system.
This commit is contained in:
parent
cc8f0a79e2
commit
5875b25e68
@ -21,6 +21,13 @@ class ProblemCheck
|
|||||||
#
|
#
|
||||||
config_accessor :retry_after, default: 30.seconds, instance_writer: false
|
config_accessor :retry_after, default: 30.seconds, instance_writer: false
|
||||||
|
|
||||||
|
# How many consecutive times the check can fail without notifying admins.
|
||||||
|
# This can be used to give some leeway for transient problems. Note that
|
||||||
|
# retries are not counted. So a check that ultimately fails after e.g. two
|
||||||
|
# retries is counted as one "blip".
|
||||||
|
#
|
||||||
|
config_accessor :max_blips, default: 0, instance_writer: false
|
||||||
|
|
||||||
def self.[](key)
|
def self.[](key)
|
||||||
key = key.to_sym
|
key = key.to_sym
|
||||||
|
|
||||||
|
@ -27,6 +27,12 @@ class ProblemCheckTracker < ActiveRecord::Base
|
|||||||
def check
|
def check
|
||||||
ProblemCheck[identifier]
|
ProblemCheck[identifier]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def sound_the_alarm?
|
||||||
|
blips > check.max_blips
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
|
Loading…
Reference in New Issue
Block a user