Skip to content

Commit 6d496f0

Browse files
committed
Apply review comments
1 parent 788cf52 commit 6d496f0

File tree

6 files changed

+134
-142
lines changed

6 files changed

+134
-142
lines changed

redis/_parsers/base.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ def __del__(self):
129129
def on_connect(self, connection):
130130
"Called when the socket connects"
131131
self._sock = connection._sock
132-
timeout = connection.socket_timeout
133-
self._buffer = SocketBuffer(self._sock, self.socket_read_size, timeout)
132+
self._buffer = SocketBuffer(
133+
self._sock, self.socket_read_size, connection.socket_timeout
134+
)
134135
self.encoder = connection.encoder
135136

136137
def on_disconnect(self):
@@ -201,19 +202,18 @@ def handle_push_response(self, response, **kwargs):
201202
if msg_type in _INVALIDATION_MESSAGE and self.invalidation_push_handler_func:
202203
return self.invalidation_push_handler_func(response)
203204
if msg_type in _MOVING_MESSAGE and self.node_moving_push_handler_func:
204-
if msg_type in _MOVING_MESSAGE:
205-
host, port = response[2].decode().split(":")
206-
ttl = response[1]
207-
id = 1 # Hardcoded value for sync parser
208-
notification = NodeMovingEvent(id, host, port, ttl)
209-
return self.node_moving_push_handler_func(notification)
205+
host, port = response[2].decode().split(":")
206+
ttl = response[1]
207+
id = 1 # Hardcoded value until the notification starts including the id
208+
notification = NodeMovingEvent(id, host, port, ttl)
209+
return self.node_moving_push_handler_func(notification)
210210
if msg_type in _MAINTENANCE_MESSAGES and self.maintenance_push_handler_func:
211211
if msg_type in _MIGRATING_MESSAGE:
212212
ttl = response[1]
213-
id = 2 # Hardcoded value for sync parser
213+
id = 2 # Hardcoded value until the notification starts including the id
214214
notification = NodeMigratingEvent(id, ttl)
215215
elif msg_type in _MIGRATED_MESSAGE:
216-
id = 3 # Hardcoded value for sync parser
216+
id = 3 # Hardcoded value until the notification starts including the id
217217
notification = NodeMigratedEvent(id)
218218
else:
219219
notification = None

0 commit comments

Comments
 (0)