Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewChecker ¶
func NewChecker( logger lager.Logger, checkFactory db.CheckFactory, engine engine.Engine, checkRateCalculator RateCalculator, ) *checker
Types ¶
type CheckRateCalculator ¶
type CheckRateCalculator struct { MaxChecksPerSecond int ResourceCheckingInterval time.Duration CheckableCounter CheckableCounter }
func (CheckRateCalculator) RateLimiter ¶
func (c CheckRateCalculator) RateLimiter() (Limiter, error)
RateLimiter determines the rate at which the checks should be limited to per second.
It is dependent on the max checks per second configuration, where if it is configured to -1 then it there is no limit, if it is > 0 then it is set to its configured value and if it is 0 (which is default) then it is calculated using the number of checkables and the resource checking interval.
The calculated limit is determined by finding the ideal number of checks to run per second in order to check all the checkables in the database within the resource checking interval. By enforcing that ideal rate of checks, it will help spread out the number of checks that are started within the same interval.