@@ -199,6 +199,14 @@ export abstract class ClusterAdapter extends Adapter {
199199 return debug ( "[%s] ignore message from self" , this . uid ) ;
200200 }
201201
202+ if ( message . nsp !== this . nsp . name ) {
203+ return debug (
204+ "[%s] ignore message from another namespace (%s)" ,
205+ this . uid ,
206+ message . nsp ,
207+ ) ;
208+ }
209+
202210 debug (
203211 "[%s] new event of type %d from %s" ,
204212 this . uid ,
@@ -671,6 +679,8 @@ export abstract class ClusterAdapter extends Adapter {
671679 protected publish (
672680 message : DistributiveOmit < ClusterMessage , "nsp" | "uid" > ,
673681 ) : void {
682+ debug ( "[%s] sending message %s" , this . uid , message . type ) ;
683+
674684 this . publishAndReturnOffset ( message ) . catch ( ( err ) => {
675685 debug ( "[%s] error while publishing message: %s" , this . uid , err ) ;
676686 } ) ;
@@ -699,6 +709,9 @@ export abstract class ClusterAdapter extends Adapter {
699709 ) {
700710 ( response as ClusterResponse ) . uid = this . uid ;
701711 ( response as ClusterResponse ) . nsp = this . nsp . name ;
712+
713+ debug ( "[%s] sending response %s to %s" , this . uid , response . type , requesterUid ) ;
714+
702715 this . doPublishResponse ( requesterUid , response as ClusterResponse ) . catch (
703716 ( err ) => {
704717 debug ( "[%s] error while publishing response: %s" , this . uid , err ) ;
@@ -790,17 +803,10 @@ export abstract class ClusterAdapterWithHeartbeat extends ClusterAdapter {
790803 }
791804
792805 if ( message . uid && message . uid !== EMITTER_UID ) {
793- // we track the UID of each sender, in order to know how many servers there are in the cluster
806+ // we track the UID of each sender to know how many servers there are in the cluster
794807 this . nodesMap . set ( message . uid , Date . now ( ) ) ;
795808 }
796809
797- debug (
798- "[%s] new event of type %d from %s" ,
799- this . uid ,
800- message . type ,
801- message . uid ,
802- ) ;
803-
804810 switch ( message . type ) {
805811 case MessageType . INITIAL_HEARTBEAT :
806812 this . publish ( {
0 commit comments