diff options
author | David Cramer <dcramer@gmail.com> | 2012-07-04 14:08:30 +0200 |
---|---|---|
committer | David Cramer <dcramer@gmail.com> | 2012-07-04 14:08:30 +0200 |
commit | 2ca52a31c2b857dbf396c32b567ee3afe839eb44 (patch) | |
tree | fb46d524f05a5dd80f7cacf0ea4ae05a4cc78095 | |
parent | 19a2826b049e3cfbae31dd3711b9787c93776259 (diff) | |
download | raven-2ca52a31c2b857dbf396c32b567ee3afe839eb44.tar.gz |
Improve SentryWorker middleware
-rw-r--r-- | raven/contrib/async.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/raven/contrib/async.py b/raven/contrib/async.py index 0b343ae..4f83c57 100644 --- a/raven/contrib/async.py +++ b/raven/contrib/async.py @@ -97,11 +97,10 @@ class SentryWorker(object): >>> from raven.base import Client >>> application = SentryWorker(application) """ - def __init__(self, application): + def __init__(self, application, worker=None): self.application = application - self.worker = AsyncWorker() + self.worker = worker or AsyncWorker() def __call__(self, environ, start_response): environ['raven.worker'] = self.worker - for event in self.application(environ, start_response): - yield event + return iter(self.application(environ, start_response)) |