Skip to content

Commit

Permalink
Only reassign bot clients when something has changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon committed Aug 21, 2024
1 parent 097aa7b commit 1497132
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion GuildWarsPartySearch.NodeJSServer/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ function on_recv_parties(ws, data) {
data.district_region = region_from_district(data.district);
}
const district_region = to_number(data.district_region);
const map_changed = bot_client.map_id !== map_id || bot_client.district_region !== district_region;
bot_client.map_id = map_id;
bot_client.district_region = district_region;
// NB: don't give a shit about language
Expand Down Expand Up @@ -369,7 +370,8 @@ function on_recv_parties(ws, data) {
Object.keys(maps_affected).forEach((map_id) => {
send_map_parties(to_number(map_id));
});
reassign_bot_clients();
if(map_changed)
reassign_bot_clients();
}

/**
Expand Down

0 comments on commit 1497132

Please sign in to comment.