From 6e3f102fb2fb5d49dc73d8b124741930ac3adf5e Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 22 Feb 2017 15:53:52 +0000 Subject: [PATCH] rate limit on sentry reporting --- libraries/logger/logging-manager.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/logger/logging-manager.coffee b/libraries/logger/logging-manager.coffee index a915e07bca..33f3ce8c49 100644 --- a/libraries/logger/logging-manager.coffee +++ b/libraries/logger/logging-manager.coffee @@ -54,7 +54,13 @@ module.exports = Logger = @logger.info.apply(@logger, arguments) error: (attributes, message, args...)-> @logger.error(attributes, message, args...) - @captureException(attributes, message, "error") if @raven? + if @raven? + now = new Date() + rateLimited = (now - @lastErrorTimeStamp) < 30 * 1000 + # only report one error every thirty seconds to avoid overload + if not rateLimited + @captureException(attributes, message, "error") + @lastErrorTimeStamp = now err: () -> @error.apply(this, arguments) warn: ()->