diff --git a/gunicorn/workers/async.py b/gunicorn/workers/async.py index 1b6cf1c0..8669a6ee 100644 --- a/gunicorn/workers/async.py +++ b/gunicorn/workers/async.py @@ -78,7 +78,6 @@ class AsyncWorker(base.Worker): respiter.close() if req.should_close(): raise StopIteration() - self.cfg.post_request(self, req) except StopIteration: raise except Exception, e: @@ -87,4 +86,9 @@ class AsyncWorker(base.Worker): raise util.write_error(sock, traceback.format_exc()) return False + finally: + try: + self.cfg.post_request(self, req) + except: + pass return True diff --git a/gunicorn/workers/sync.py b/gunicorn/workers/sync.py index c2d7eea5..23d6b453 100644 --- a/gunicorn/workers/sync.py +++ b/gunicorn/workers/sync.py @@ -104,7 +104,6 @@ class SyncWorker(base.Worker): resp.close() if hasattr(respiter, "close"): respiter.close() - self.cfg.post_request(self, req) except socket.error: raise except Exception, e: @@ -113,3 +112,9 @@ class SyncWorker(base.Worker): raise util.write_error(client, traceback.format_exc()) return + finally: + try: + self.cfg.post_request(self, req) + except: + pass +