Skip to content

Commit 2736aaa

Browse files
committed
Fixing lint errors
1 parent 822fccd commit 2736aaa

File tree

2 files changed

+31
-32
lines changed

2 files changed

+31
-32
lines changed

redis/connection.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,9 +2018,7 @@ def update_active_connections_for_reconnect(
20182018
:param tmp_relax_timeout: The relax timeout to use for the connection.
20192019
"""
20202020
for conn in self._in_use_connections:
2021-
if self.should_update_connection(
2022-
conn, "connected", moving_address_src
2023-
):
2021+
if self.should_update_connection(conn, "connected", moving_address_src):
20242022
self._update_connection_for_reconnect(
20252023
conn, tmp_host_address, tmp_relax_timeout
20262024
)
@@ -2042,9 +2040,7 @@ def disconnect_and_reconfigure_free_connections(
20422040
"""
20432041

20442042
for conn in self._available_connections:
2045-
if self.should_update_connection(
2046-
conn, "connected", moving_address_src
2047-
):
2043+
if self.should_update_connection(conn, "connected", moving_address_src):
20482044
self._disconnect_and_update_connection_for_reconnect(
20492045
conn, tmp_host_address, tmp_relax_timeout
20502046
)
@@ -2312,15 +2308,15 @@ def disconnect(self):
23122308
self._locked = False
23132309

23142310
def update_connections_settings(
2315-
self,
2316-
state: Optional["MaintenanceState"] = None,
2317-
relax_timeout: Optional[float] = None,
2318-
matching_address: Optional[str] = None,
2319-
address_type_to_match: Literal["connected", "configured"] = "connected",
2320-
reset_host_address: bool = False,
2321-
reset_relax_timeout: bool = False,
2322-
include_free_connections: bool = True,
2323-
):
2311+
self,
2312+
state: Optional["MaintenanceState"] = None,
2313+
relax_timeout: Optional[float] = None,
2314+
matching_address: Optional[str] = None,
2315+
address_type_to_match: Literal["connected", "configured"] = "connected",
2316+
reset_host_address: bool = False,
2317+
reset_relax_timeout: bool = False,
2318+
include_free_connections: bool = True,
2319+
):
23242320
"""
23252321
Override base class method to work with BlockingConnectionPool's structure.
23262322
"""
@@ -2424,4 +2420,3 @@ def set_in_maintenance(self, in_maintenance: bool):
24242420
The pool will be in maintenance mode only when we are processing a MOVING event.
24252421
"""
24262422
self._in_maintenance = in_maintenance
2427-

redis/maintenance_events.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -378,20 +378,20 @@ def handle_node_moving_event(self, event: NodeMovingEvent):
378378
)
379379

380380
if self.config.proactive_reconnect:
381-
# take care for the active connections in the pool
382-
# mark them for reconnect after they complete the current command
383-
self.pool.update_active_connections_for_reconnect(
384-
tmp_host_address=event.new_node_host,
385-
tmp_relax_timeout=self.config.relax_timeout,
386-
moving_address_src=moving_address_src,
387-
)
388-
# take care for the inactive connections in the pool
389-
# delete them and create new ones
390-
self.pool.disconnect_and_reconfigure_free_connections(
391-
tmp_host_address=event.new_node_host,
392-
tmp_relax_timeout=self.config.relax_timeout,
393-
moving_address_src=moving_address_src,
394-
)
381+
# take care for the active connections in the pool
382+
# mark them for reconnect after they complete the current command
383+
self.pool.update_active_connections_for_reconnect(
384+
tmp_host_address=event.new_node_host,
385+
tmp_relax_timeout=self.config.relax_timeout,
386+
moving_address_src=moving_address_src,
387+
)
388+
# take care for the inactive connections in the pool
389+
# delete them and create new ones
390+
self.pool.disconnect_and_reconfigure_free_connections(
391+
tmp_host_address=event.new_node_host,
392+
tmp_relax_timeout=self.config.relax_timeout,
393+
moving_address_src=moving_address_src,
394+
)
395395

396396
# Update config for new connections:
397397
# Set state to MOVING
@@ -426,8 +426,12 @@ def handle_node_moved_event(self, event: NodeMovingEvent):
426426
# and we don't need to revert the kwargs
427427
if self.pool.connection_kwargs.get("host") == event.new_node_host:
428428
orig_host = self.pool.connection_kwargs.get("orig_host_address")
429-
orig_socket_timeout = self.pool.connection_kwargs.get("orig_socket_timeout")
430-
orig_connect_timeout = self.pool.connection_kwargs.get("orig_socket_connect_timeout")
429+
orig_socket_timeout = self.pool.connection_kwargs.get(
430+
"orig_socket_timeout"
431+
)
432+
orig_connect_timeout = self.pool.connection_kwargs.get(
433+
"orig_socket_connect_timeout"
434+
)
431435
kwargs: dict = {
432436
"maintenance_state": MaintenanceState.NONE,
433437
"host": orig_host,

0 commit comments

Comments
 (0)