@@ -377,27 +377,29 @@ export default class RedisClusterSlots<
377377 const socket =
378378 this . #getNodeAddress( node . address ) ??
379379 { host : node . host , port : node . port , } ;
380- const client = Object . freeze ( {
380+ const clientInfo = Object . freeze ( {
381381 host : socket . host ,
382382 port : socket . port ,
383383 } ) ;
384384 const emit = this . #emit;
385- return this . #clientFactory(
385+ const client = this . #clientFactory(
386386 this . #clientOptionsDefaults( {
387387 clientSideCache : this . clientSideCache ,
388388 RESP : this . #options. RESP ,
389389 socket,
390390 readonly,
391391 } ) )
392- . on ( 'error' , error => emit ( 'node-error' , error , client ) )
393- . on ( 'reconnecting' , ( ) => emit ( 'node-reconnecting' , client ) )
394- . once ( 'ready' , ( ) => emit ( 'node-ready' , client ) )
395- . once ( 'connect' , ( ) => emit ( 'node-connect' , client ) )
396- . once ( 'end' , ( ) => emit ( 'node-disconnect' , client ) ) ;
392+ . on ( 'error' , error => emit ( 'node-error' , error , clientInfo ) )
393+ . on ( 'reconnecting' , ( ) => emit ( 'node-reconnecting' , clientInfo ) )
394+ . once ( 'ready' , ( ) => emit ( 'node-ready' , clientInfo ) )
395+ . once ( 'connect' , ( ) => emit ( 'node-connect' , clientInfo ) )
396+ . once ( 'end' , ( ) => emit ( 'node-disconnect' , clientInfo ) )
397397 . on ( '__MOVED' , ( ) => {
398398 console . log ( `cluster::createClient -> MOVED, rediscover` ) ;
399399 this . rediscover ( client ) ;
400- } )
400+ } ) ;
401+
402+ return client ;
401403 }
402404
403405 #createNodeClient( node : ShardNode < M , F , S , RESP , TYPE_MAPPING > , readonly ?: boolean ) {
0 commit comments