asyncio-redis
asyncio-redis copied to clipboard
Bad handling of timeouts in pubsub subscriptions
Heroku addons like to timeout out connections, which this library doesn't handle well.
Fix at https://github.com/mrdon/asyncio-redis/commit/7edcd90834550f2ff214225eec434df65ce3e1e5
mrdon's patch also fixes an issue with lost exception when Redis server dies/disconnects while the client is waiting for message. With 0.13.4 I got this error:
2015-10-22 13:42:59,090 [INFO] asyncio_redis:853 eof_received - EOF received in RedisProtocol
2015-10-22 13:42:59,091 [ERROR] asyncio:1008 default_exception_handler - Task exception was never retrieved
future: <Task finished coro=<_reader_coroutine() done, defined at /Users/rivo/Projektid/gridens/venv/lib/python3.4/site-packages/asyncio_redis/protocol.py:912> exception=IncompleteReadError('0 bytes read on a total of 1 expected bytes',)>
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/tasks.py", line 238, in _step
result = next(coro)
File "/Users/rivo/Projektid/gridens/venv/lib/python3.4/site-packages/asyncio_redis/protocol.py", line 919, in _reader_coroutine
yield from self._handle_item(self._push_answer)
File "/Users/rivo/Projektid/gridens/venv/lib/python3.4/site-packages/asyncio_redis/protocol.py", line 927, in _handle_item
c = yield from self._reader.readexactly(1)
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/streams.py", line 482, in readexactly
raise IncompleteReadError(partial, len(partial) + n)
asyncio.streams.IncompleteReadError: 0 bytes read on a total of 1 expected bytes
2015-10-22 13:42:59,095 [INFO] asyncio_redis:877 connection_lost - Redis connection lost
With the patch, it works without printing any errors (and no noticeable changes in behavior).
Ok, I'll have a second look later this week and I'll guess I will merge it if nobody is against.
Thanks for reporting everyone!
Looks like it was not merged yet. Please fix. Thank you.
Thanks for reminding me! It's merged in: https://github.com/jonathanslenders/asyncio-redis/commit/c524f915af02f523daaf47754f93fa0a464e28b4
I'll push a new release to Pypi very soon.
Awesome, thanks @jonathanslenders !