Skip to content

Commit

Permalink
Bump gevent version
Browse files Browse the repository at this point in the history
This should stop the logging that occurs when clients disconnect.
gevent/gevent#377
  • Loading branch information
tilgovi committed Sep 17, 2015
1 parent 5db057e commit 27a68e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions h/server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-
from datetime import datetime

from gunicorn.workers.ggevent import GeventPyWSGIWorker, PyWSGIHandler
from gunicorn.workers.ggevent import GeventResponse
from ws4py.server.geventserver import WSGIServer, WebSocketWSGIHandler


Expand All @@ -18,6 +21,19 @@ def finalize_headers(self):

super(WSGIHandler, self).finalize_headers()

def log_request(self):
start = datetime.fromtimestamp(self.time_start)
finish = datetime.fromtimestamp(self.time_finish)
response_time = finish - start
resp_headers = getattr(self, 'response_headers', {})
resp = GeventResponse(self.status, resp_headers, self.response_length)
if hasattr(self, 'headers'):
req_headers = [h.split(":", 1) for h in self.headers.headers]
else:
req_headers = []
self.server.log.logger.access(resp, req_headers, self.environ,
response_time)


class Worker(GeventPyWSGIWorker):
server_class = WSGIServer
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def run_tests(self):
'cryptography>=0.7',
'deform>=0.9,<1.0',
'elasticsearch>=1.1.0',
'gevent>=1.0.2,<1.1.0',
'gevent>=1.1.0b1,<1.2.0',
'gnsq>=0.3.0,<0.4.0',
'gunicorn>=19.2,<20',
'hashids==1.1.0', # hashid format may change with updated hashid package,
Expand Down

0 comments on commit 27a68e2

Please sign in to comment.