Skip to content

Commit

Permalink
Don't update agent_id_to_socket when the key is already deleted (#637)
Browse files Browse the repository at this point in the history
* server.js don't update agent_id_to_socket when the key is already
deleted

* lint
  • Loading branch information
Jing committed Jan 6, 2022
1 parent 82b22c7 commit 69c0560
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mephisto/abstractions/architects/router/deploy/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,10 @@ wss.on("connection", function (socket) {
agent.last_ping = Date.now();
packet.data.status = agent.status;
packet.data.state = agent.state;
if (agent_id_to_socket[agent.agent_id] != socket) {
if (
agent_id_to_socket[agent.agent_id] != socket &&
agent_id_to_socket[agent.agent_id] != undefined
) {
// Not communicating to the correct socket, update
debug_log("Updating socket for ", agent);
agent_id_to_socket[agent.agent_id] = socket;
Expand Down

0 comments on commit 69c0560

Please sign in to comment.