@@ -642,7 +642,7 @@ async def execute_command(self, *args: EncodableT, **kwargs: Any) -> Any:
642642 keys = [node .name for node in target_nodes ]
643643 values = await asyncio .gather (
644644 * (
645- asyncio .ensure_future (
645+ asyncio .create_task (
646646 self ._execute_command (node , * args , ** kwargs )
647647 )
648648 for node in target_nodes
@@ -841,7 +841,7 @@ def __del__(self) -> None:
841841 async def disconnect (self ) -> None :
842842 ret = await asyncio .gather (
843843 * (
844- asyncio .ensure_future (connection .disconnect ())
844+ asyncio .create_task (connection .disconnect ())
845845 for connection in self ._connections
846846 ),
847847 return_exceptions = True ,
@@ -979,13 +979,13 @@ def set_nodes(
979979 if remove_old :
980980 for name in list (old .keys ()):
981981 if name not in new :
982- asyncio .ensure_future (old .pop (name ).disconnect ())
982+ asyncio .create_task (old .pop (name ).disconnect ())
983983
984984 for name , node in new .items ():
985985 if name in old :
986986 if old [name ] is node :
987987 continue
988- asyncio .ensure_future (old [name ].disconnect ())
988+ asyncio .create_task (old [name ].disconnect ())
989989 old [name ] = node
990990
991991 def _update_moved_slots (self ) -> None :
@@ -1202,7 +1202,7 @@ async def close(self, attr: str = "nodes_cache") -> None:
12021202 self .default_node = None
12031203 await asyncio .gather (
12041204 * (
1205- asyncio .ensure_future (node .disconnect ())
1205+ asyncio .create_task (node .disconnect ())
12061206 for node in getattr (self , attr ).values ()
12071207 )
12081208 )
@@ -1381,7 +1381,7 @@ async def _execute(
13811381
13821382 errors = await asyncio .gather (
13831383 * (
1384- asyncio .ensure_future (node [0 ].execute_pipeline (node [1 ]))
1384+ asyncio .create_task (node [0 ].execute_pipeline (node [1 ]))
13851385 for node in nodes .values ()
13861386 )
13871387 )
0 commit comments