Skip to content
This repository has been archived by the owner on May 22, 2022. It is now read-only.

Commit

Permalink
event-collector queue: Keep connections open
Browse files Browse the repository at this point in the history
Python requests sessions can take advantage of keep-alive, but you have to
read from the response.content for it to work.

http://docs.python-requests.org/en/latest/user/advanced/#keep-alive
  • Loading branch information
kemitche committed May 5, 2015
1 parent 11ee44c commit ff8e92d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions r2/r2/lib/eventcollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ def _chunk_events(self, events):
def publish(self, events):
for some_events in self._chunk_events(events):
resp = self._publish(some_events)
# read from resp.content, so that the connection can be re-used
# http://docs.python-requests.org/en/latest/user/advanced/#keep-alive
ignored = resp.content
yield resp, some_events


Expand Down

0 comments on commit ff8e92d

Please sign in to comment.