From 2ecea4a2d179f13add0806e7667ae69d05757b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Miguel=20Neves?= Date: Fri, 16 Mar 2018 19:39:00 +0000 Subject: [PATCH] release 0.2.1 --- setup.py | 4 ++-- zappa_sentry/__init__.py | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index c5d9dbc..166e87a 100644 --- a/setup.py +++ b/setup.py @@ -3,12 +3,12 @@ setup( name = 'zappa_sentry', packages = ['zappa_sentry'], - version = '0.2.0', + version = '0.2.1', description = 'Easy integration with sentry for zappa apps', author = 'João Miguel Neves', author_email = 'joao@silvaneves.org', url = 'https://github.com/jneves/zappa-sentry', - download_url = 'https://github.com/jneves/zappa-sentry/archive/0.2.0.tar.gz', + download_url = 'https://github.com/jneves/zappa-sentry/archive/0.2.1.tar.gz', keywords = 'logging zappa sentry', install_requires=[ 'raven' diff --git a/zappa_sentry/__init__.py b/zappa_sentry/__init__.py index 00dd88b..9d4b5f8 100644 --- a/zappa_sentry/__init__.py +++ b/zappa_sentry/__init__.py @@ -6,14 +6,17 @@ from raven.transport.http import HTTPTransport -raven_config = ConfigParser(os.environ) -_raven_client = None +# Cache this value and clients in the module to reduce overhead +this = sys.modules[__name__] + +this.raven_config = ConfigParser(os.environ) +this._raven_client = None def get_raven_client(): - if not _raven_client: - _raven_client = Client(raven_config.get('DEFAULT', 'SENTRY_DSN'), transport=HTTPTransport) - return _raven_client + if not this._raven_client: + this._raven_client = Client(this.raven_config.get('DEFAULT', 'SENTRY_DSN'), transport=HTTPTransport) + return this._raven_client def unhandled_exceptions(e, event, context):