Added recreation check: Before creating a missing channel, the code now checks isRecreating(pluginDomain, protocol, peerId) to prevent duplicate creation attempts
This commit is contained in:
@@ -1305,6 +1305,12 @@ function performHealthCheck() {
|
||||
for (const [protocol, channelInfo] of protocolMap.entries()) {
|
||||
const peerChannel = channelInfo.peerChannels?.get(peerId);
|
||||
if (!peerChannel) {
|
||||
// Check if this channel is currently being recreated to prevent loops
|
||||
if (isRecreating(pluginDomain, protocol, peerId)) {
|
||||
logDebug('ChannelManager', `Channel ${pluginDomain}-${protocol} for peer ${peerId.substring(0, 16)}... is already being recreated, skipping health check creation`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Peer is connected but missing this channel - create it
|
||||
const isReconnection = state.peerHistory?.get(peerId)?.some(event => event.type === 'connect') || false;
|
||||
const reconnectionNote = isReconnection ? ' (reconnection)' : '';
|
||||
|
||||
Reference in New Issue
Block a user