-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
automatically reconnect pubsub when reading messages in blocking mode (…
…#2281) * optimistic default info on test sessionstart. Makes test discovery work, even without a redis connection. * Add unittests verifying that (non-async) PubSub will automatically reconnect * Add tests for asyncio pubsub subsciription auto-reconnect * automatically connect for blocking reads (asyncio) * fix automatic connect on blocking pubsub read (non-async) * lint & format * Perform `connect()` call in PubSub code rather than `read_response`.
- Loading branch information
1 parent
48f5aca
commit f9f9d06
Showing
6 changed files
with
298 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
import asyncio | ||
import sys | ||
from unittest import mock | ||
|
||
try: | ||
mock.AsyncMock | ||
except AttributeError: | ||
import mock | ||
|
||
|
||
def create_task(coroutine): | ||
if sys.version_info[:2] >= (3, 7): | ||
return asyncio.create_task(coroutine) | ||
else: | ||
return asyncio.ensure_future(coroutine) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters