From 0bb4f40c1c745ff7a0dc834eda1b4b2cbcd58a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 22 Feb 2013 09:25:06 +0100 Subject: [PATCH] publisher: do not fail on early statsd call (#2521) --- wcs/qommon/publisher.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wcs/qommon/publisher.py b/wcs/qommon/publisher.py index 3ca5beebe..688477faf 100644 --- a/wcs/qommon/publisher.py +++ b/wcs/qommon/publisher.py @@ -97,6 +97,7 @@ class QommonPublisher(Publisher): missing_appdir_redirect = None use_sms_feature = True app_translations = dict() + statsd = None def get_root_url(self): if self.get_request(): @@ -250,7 +251,8 @@ class QommonPublisher(Publisher): original_response = request.response request.response = HTTPResponse() - self.statsd.increment('failed-request') + if self.statsd: # maybe unset if very early failure + self.statsd.increment('failed-request') (exc_type, exc_value, tb) = sys.exc_info()