REFACTOR: Speed up by-ip lookups by introducing a new map entry (#2488)

Thankfully, the existing AllServers map is not exported, so we can
ensure that all the changes are only local to this file.

This also fixes a bug if renameServer was called with the same
name. (Probably calling code checked that case already.)
This commit is contained in:
David Walker
2026-02-11 10:43:52 -08:00
committed by GitHub
parent 826fd42296
commit 26b5c28df6
3 changed files with 40 additions and 29 deletions
+1 -5
View File
@@ -13,7 +13,7 @@
import { Player } from "@player";
import { AugmentationName, CityName, CodingContractName, LocationName } from "@enums";
import { GetAllServers, renameServer } from "../Server/AllServers";
import { GetAllServers } from "../Server/AllServers";
import { StockMarket } from "../StockMarket/StockMarket";
import { AwardNFG, v1APIBreak } from "./v1APIBreak";
import { Settings } from "../Settings/Settings";
@@ -89,10 +89,6 @@ export async function evaluateVersionCompatibility(ver: string | number): Promis
delete anyPlayer.companyPosition;
}
if (ver < "0.56.0") {
// In older versions, keys of AllServers are IP addresses instead of hostnames.
for (const server of GetAllServers()) {
renameServer(server.ip, server.hostname);
}
for (const q of anyPlayer.queuedAugmentations) {
if (q.name === "Graphene BranchiBlades Upgrade") {
q.name = "Graphene BrachiBlades Upgrade";