diff --git a/bouncer.js b/bouncer.js index b553c52..92e8fdd 100644 --- a/bouncer.js +++ b/bouncer.js @@ -116,7 +116,7 @@ module.exports = (ws, req) => { terminate_subs(ws.id); for (i of ws.reconnectTimeout) { - clearInterval(i); + clearTimeout(i); // Let the garbage collector do the thing. No need to add ws.reconnectTimeout.delete(i); } }); @@ -271,7 +271,7 @@ function newConn(addr, id) { if (process.env.LOG_ABOUT_RELAYS || log_about_relays) console.log(process.pid, "---", `[${id}]`, `got EOSE from ${relay.url} for ${data[1]}. There are ${client.pendingEOSE.get(data[1])} EOSE received out of ${Array.from(socks).filter(sock => sock.id === id).length} connected relays.`); if (!cache_relays?.includes(relay.url)) { - if (wait_eose && (client.pendingEOSE.get(data[1]) < (max_eose_score || Array.from(socks).filter(sock => sock.id === id).length))) return; + if (wait_eose && ((client.pendingEOSE.get(data[1]) < max_eose_score) || (client.pendingEOSE.get(data[1]) < Array.from(socks).filter(sock => sock.id === id).length))) return; if (client.pause_subs.has(data[1])) return client.pause_subs.delete(data[1]); cancel_EOSETimeout(data[1]);