Get all nodes from startup nodes & creates connections if not initialized.
(
self,
additional_startup_nodes_info: Optional[List[Tuple[str, int]]] = None,
last_failed_node_name: Optional[str] = None,
)
| 555 | self._usage_lock = asyncio.Lock() |
| 556 | |
| 557 | async def initialize( |
| 558 | self, |
| 559 | additional_startup_nodes_info: Optional[List[Tuple[str, int]]] = None, |
| 560 | last_failed_node_name: Optional[str] = None, |
| 561 | ) -> "RedisCluster": |
| 562 | """Get all nodes from startup nodes & creates connections if not initialized.""" |
| 563 | if self._initialize: |
| 564 | if not self._lock: |
| 565 | self._lock = asyncio.Lock() |
| 566 | async with self._lock: |
| 567 | if self._initialize: |
| 568 | try: |
| 569 | await self.nodes_manager.initialize( |
| 570 | additional_startup_nodes_info=additional_startup_nodes_info, |
| 571 | last_failed_node_name=last_failed_node_name, |
| 572 | ) |
| 573 | await self.commands_parser.initialize( |
| 574 | self.nodes_manager.default_node |
| 575 | ) |
| 576 | self._initialize = False |
| 577 | except BaseException: |
| 578 | await self.nodes_manager.aclose() |
| 579 | await self.nodes_manager.aclose("startup_nodes") |
| 580 | raise |
| 581 | return self |
| 582 | |
| 583 | async def aclose(self) -> None: |
| 584 | """Close all connections & client if initialized.""" |
no test coverage detected