Skip to content

Commit

Permalink
worker_bouncer: use <array>.splice(<index>, 1) for removing instead o…
Browse files Browse the repository at this point in the history
…f just delete

Signed-off-by: Yonle <yonle@lecturify.net>
  • Loading branch information
Yonle committed May 28, 2024
1 parent 98469a4 commit 533f3e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions worker_bouncer.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +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);
delete relays[relays.indexOf(addr)];
delete cache_relays[cache_relays.indexOf(addr)];
delete loadbalancer[loadbalancer.indexOf(addr)];
relays.splice(relays.indexOf(addr), 1);
cache_relays.splice(cache_relays.indexOf(addr), 1);
loadbalancer.splice(loadbalancer.indexOf(addr), 1);
console.log(threadId, "-!-", `${addr} give status code ${res.statusCode}. Not (re)connect with new session again.`);

stats._global.f++
Expand Down

0 comments on commit 533f3e6

Please sign in to comment.