File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1+ const cluster = require ( 'cluster' ) ;
12const redis = require ( './broker/redis' ) ;
23const { getProtoBuf } = require ( "./utils/protoBuf" ) ;
34const { randomNum, timeout} = require ( "./utils/tool" ) ;
@@ -293,23 +294,25 @@ class Hub {
293294
294295 async _handlePeerNotFound ( client , toPeerId , peerId ) {
295296 // this.logger.info(`_handlePeerNotFound ${client} ${toPeerId} ${peerId}`);
296- this . stats . notFoundCount ++ ;
297297 const msg = {
298298 action : 'signal' ,
299299 from_peer_id : toPeerId ,
300300 }
301301 if ( client ) {
302302 if ( toPeerId === client . notFoundIdCache ) return
303303 client . notFoundIdCache = toPeerId ;
304+ this . stats . notFoundCount ++ ;
304305 return this . sendJsonToClient ( client , msg ) ;
305306 }
306307 // polling to another worker
307- if ( redis . getIsAlive ( ) ) {
308+ if ( ! cluster . isPrimary && redis . getIsAlive ( ) ) {
308309 const { node } = await this . _getRemotePeerInfo ( peerId ) ;
309310 if ( node ) {
310311 // this.logger.info(`polling to another worker, send peer not found`);
311312 if ( ! node . sendMsgSignal ( msg , peerId ) ) {
312313 // this.logger.warn(`sendMsgSignal to remote ${addr} failed`);
314+ } else {
315+ this . stats . notFoundCount ++ ;
313316 }
314317 }
315318 }
You can’t perform that action at this time.
0 commit comments