Skip to content

Commit

Permalink
[3.5] misc docs fix - background tasks example throws a deprecation w…
Browse files Browse the repository at this point in the history
…arning (#3529) (#3531)

(cherry picked from commit 2d8aa12)

Co-authored-by: Goran Cetušić <[email protected]>
  • Loading branch information
asvetlov and gcetusic authored Jan 13, 2019
1 parent f6f647e commit c6ee1a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/3526.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Modify documentation for Background Tasks to remove deprecated usage of event loop.
4 changes: 2 additions & 2 deletions docs/web_advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ signal handlers as shown in the example below::

async def listen_to_redis(app):
try:
sub = await aioredis.create_redis(('localhost', 6379), loop=app.loop)
sub = await aioredis.create_redis(('localhost', 6379))
ch, *_ = await sub.subscribe('news')
async for msg in ch.iter(encoding='utf-8'):
# Forward message to all connected websockets:
Expand All @@ -956,7 +956,7 @@ signal handlers as shown in the example below::


async def start_background_tasks(app):
app['redis_listener'] = app.loop.create_task(listen_to_redis(app))
app['redis_listener'] = asyncio.create_task(listen_to_redis(app))


async def cleanup_background_tasks(app):
Expand Down

0 comments on commit c6ee1a7

Please sign in to comment.