worker: do not reconnect to cache relays/loadbalancer bouncers if status code ix 4xx

Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
Yonle
2024-05-21 16:32:07 +07:00
parent 6d50753390
commit b99795f9d8

View File

@@ -446,7 +446,9 @@ function newConn(addr, id, reconn_t = 0) {
if (!userRelays.hasOwnProperty(id)) return;
userRelays[id].delete(relay);
if (res.statusCode >= 500) return relay.emit("close", null);
relays = relays.filter(_ => _ != addr);
delete relays[relays.indexOf(addr)];
delete cache_relays[cache_relays.indexOf(addr)];
delete loadbalancer[loadbalancer.indexOf(addr)];
console.log(threadId, "-!-", `${addr} give status code ${res.statusCode}. Not (re)connect with new session again.`);
stats._global.f++