Skip to content

Commit

Permalink
save a reference to created tasks, to avoid tasks disappearing mid-ex…
Browse files Browse the repository at this point in the history
…ecution
  • Loading branch information
anio committed Jun 28, 2023
1 parent 9f50357 commit 0c62a77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions redis/asyncio/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1108,13 +1108,13 @@ def set_nodes(
if remove_old:
for name in list(old.keys()):
if name not in new:
asyncio.create_task(old.pop(name).disconnect())
task = asyncio.create_task(old.pop(name).disconnect())

for name, node in new.items():
if name in old:
if old[name] is node:
continue
asyncio.create_task(old[name].disconnect())
task = asyncio.create_task(old[name].disconnect())
old[name] = node

def _update_moved_slots(self) -> None:
Expand Down

0 comments on commit 0c62a77

Please sign in to comment.