Skip to content

Commit a8a4525

Browse files
committed
parse SMIGRATED according to new format
1 parent b3fb5db commit a8a4525

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/client/lib/client/enterprise-maintenance-manager.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,18 +310,17 @@ export default class EnterpriseMaintenanceManager {
310310
};
311311

312312
#onSMigrated = (push: any[]) => {
313-
// [ 'SMIGRATED', '15', [ '127.0.0.1:6379 123,456,789-1000', '127.0.0.1:6380 124,457,300-500' ] ]
314-
// ^seq ^new endpoint1 ^slots ^new endpoint2 ^slots
315-
const sequenceId = Number(push[1]);
313+
// [ 'SMIGRATED', 15, [ [ '127.0.0.1:6379', '123,456,789-1000' ], [ '127.0.0.1:6380', '124,457,300-500' ] ] ]
314+
// ^seq ^new endpoint1 ^slots ^new endpoint2 ^slots
315+
const sequenceId: number = push[1];
316316
const smigratedEvent: SMigratedEvent = {
317317
seqId: sequenceId,
318318
source: {
319319
...this.#getAddress()
320320
},
321321
destinations: []
322322
}
323-
for(const endpointInfo of push[2]) {
324-
const [endpoint, slots] = String(endpointInfo).split(' ');
323+
for(const [endpoint, slots] of push[2] as string[]) {
325324
//TODO not sure if we need to handle fqdn/ip.. cluster manages clients by host:port. If `cluster slots` returns ip,
326325
// but this notification returns fqdn, then we need to unify somehow ( maybe lookup )
327326
const [ host, port ] = endpoint.split(':');

0 commit comments

Comments
 (0)