This repository has been archived by the owner on Feb 21, 2023. It is now read-only.
Failing to discover sentinel instances results "Task was destroyed but it is pending!" #742
Labels
resolved-via-latest
This indicates this issue is either resolved or invalid as of the latest version.
Currently calling
aioredis.create_sentinel()
makes a call tocreate_sentinel_pool()
,now
create_sentinel_pool()
create a sentinel pool using SentinelPool and then call itsdiscover()
method.What we need to consider is that SentinelPool class starts a coroutine in its constructor called echo_events.
At this point, when discover() didn't get to connect to any sentinel. it raises an
Exception
butcreate_sentinel_pool
does not handle that error. you see, SentinelPool started a coroutine on initializing. so callingclose()
on SentinelPool is mandatory. especially whencreate_sentinel_pool()
is the only one that can access "pool object" in case of an error.That is why "Task was destroyed but it is pending!" happens.
This is how the last two lines of
create_sentinel_pool()
look like:I think it should be:
The text was updated successfully, but these errors were encountered: