-
Notifications
You must be signed in to change notification settings - Fork 335
RuntimeWarning: coroutine 'Redis.close' was never awaited #1086
Comments
I'm seeing this too and haven't fixed it yet. I'll take a closer look! |
I've been seeing something similar in 2.0.0, as well, when I try to close the client: File "/usr/local/lib/python3.8/asyncio/base_events.py", line 602, in run_until_complete |
Try |
Following up on this, I'm afraid using run_coroutine_threadsafe did not, in itself, fix or change the issue. I'll continue looking at it to see if I can figure out specifically what's going on. |
Any updates on this issue? |
Not an update but I use non-optimal workaround with aiohttp in my code ( async def redis_init(app):
app['rc'] = aioredis.from_url("redis://127.0.0.1")
del type(app['rc']).__del__
async def redis_close(app):
await app['rc'].close()
def run():
app = web.Application()
app.on_startup.append(redis_init)
app.on_cleanup.append(redis_close) This code cleanups Redis connection on exit but skips |
Again, at least in django, we manually close any cache backend manuallly in a post-request hook. I'm +1 on just removing the |
I have the same problem. |
@DemX86 please check master as we've merged a potential solution. |
That's great, thanks a lot! |
Soon is iffy at the moment. @seandstewart thoughts on just releasing current version as patch? Incremental patching would help more people to slowly migrate. |
Yeah I think that's a good idea. The migration to the latest redis client has numerous big changes so we'll want to have a separate release cycle and not block patches to the current version. We just need to make sure these changes make it into the new version as well. |
So this should be resolved by #1227? |
Yes. Closing for now as this is merged in v2.0.1. If it appears again, we'll reopen this issue. |
I'm using aioredis in a pytest fixture, (using pytest-asyncio), and just upgraded to 2.0.0.
At the end of my test run, I'm getting the following warning:
I'm not sure exactly why it's happening, maybe it has something to do with the way pytest-asyncio is managing the loop, but it isn't really critical (I'm not saying aioredis is doing anything wrong).
I was wondering if it would be possible to add the
if conn
check thatclose()
does to__del__()
also, such that if I make sure to manually clean it up beforehand, theclose()
coroutine won't get created at__del__
time.Happy to open a PR if it would help.
The text was updated successfully, but these errors were encountered: