try to improve handling EOSE for cached relays

Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
Yonle 2024-04-23 19:54:44 +07:00
parent bc0ff44ad0
commit 97e6293150

View File

@ -375,7 +375,8 @@ function newConn(addr, id, reconn_t = 0) {
if (log_about_relays) console.log(process.pid, "---", id, `got EOSE from ${addr} for ${data[1]}. There are ${client.pendingEOSE.get(data[1])} EOSE received out of ${userRelays.get(id).size} connected relays.`);
if (wait_eose && ((client.pendingEOSE.get(data[1]) < max_eose_score) || (client.pendingEOSE.get(data[1]) < userRelays.get(id).size))) return;
if (!relay.isCache && (wait_eose && ((client.pendingEOSE.get(data[1]) < max_eose_score) || (client.pendingEOSE.get(data[1]) < userRelays.get(id).size)))) return;
if (relay.isCache && !client.events.get(data[1]).size) return; // if cache relays did not send anything but EOSE, Don't send EOSE yet.
client.pendingEOSE.delete(data[1]);
if (client.pause_subs.has(data[1])) {