diff --git a/config/initializers/100-logster.rb b/config/initializers/100-logster.rb index 13904d283e8..ada7b9dd08e 100644 --- a/config/initializers/100-logster.rb +++ b/config/initializers/100-logster.rb @@ -64,13 +64,17 @@ store.redis_raw_connection = redis.without_namespace severities = [Logger::WARN, Logger::ERROR, Logger::FATAL, Logger::UNKNOWN] RailsMultisite::ConnectionManagement.each_connection do - if error_rate_per_minute = SiteSetting.alert_admins_if_errors_per_minute > 0 + error_rate_per_minute = SiteSetting.alert_admins_if_errors_per_minute + + if error_rate_per_minute > 0 store.register_rate_limit_per_minute(severities, error_rate_per_minute) do |rate| MessageBus.publish("/logs_error_rate_exceeded", { rate: rate, duration: 'minute' }) end end - if error_rate_per_hour = SiteSetting.alert_admins_if_errors_per_hour > 0 + error_rate_per_hour = SiteSetting.alert_admins_if_errors_per_hour + + if error_rate_per_hour > 0 store.register_rate_limit_per_hour(severities, error_rate_per_hour) do |rate| MessageBus.publish("/logs_error_rate_exceeded", { rate: rate, duration: 'hour' }) end