mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 01:27:51 -05:00
fix: send a game at login only the custom items its packs lack
Every custom item's full def row went to every game at login, though the
item and name packs it fetched minutes before already have them all: with
5000 clothing and 452 den items that was 3.3 MB, 4.2 MB with the colours,
over the send backlog limit (94b8de8 raised it).
- a fetch of the item, den item or name pack notes, per address, how far
the custom items had changed; at login a game is sent the items changed
since, and those with a picture (the packs have no pictures). an address
that fetched nothing lately is sent all, as before.
- "xdi" rows carry the fields the client reads (addItemDef,
addDenItemDef), not the whole base row, and clothing is for any animal
as in the pack.
- accounts keep a digest of the state last written, not a copy of it
(~13 KB an account, ~185 MB on prod).
Measured locally with prod-sized data (20000 colours, 5452 items, 14k
accounts): the login burst 4.2 MB -> 1.5 MB (the colours are most of what
is left), live heap after start 419 -> 297 MB.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
9f69b3511b
commit
c5b1bc37d9
6 files changed
+146
-15
No files matched your search
+5
-2
@@ -13,8 +13,11 @@ const os = require("os");
|
||||
const path = require("path");
|
||||
|
||||
class GameClient {
|
||||
constructor(gamePort) {
|
||||
// `localAddress`: another loopback address to come from (127.0.0.2), for
|
||||
// what the server tells apart by address.
|
||||
constructor(gamePort, localAddress = undefined) {
|
||||
this.gamePort = gamePort;
|
||||
this.localAddress = localAddress;
|
||||
this.queue = [];
|
||||
this.varUpdates = [];
|
||||
this.askedForGames = 0;
|
||||
@@ -25,7 +28,7 @@ class GameClient {
|
||||
|
||||
connect() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.socket = net.connect(this.gamePort, "127.0.0.1", resolve);
|
||||
this.socket = net.connect({port: this.gamePort, host: "127.0.0.1", localAddress: this.localAddress}, resolve);
|
||||
this.socket.once("error", reject);
|
||||
this.socket.on("data", chunk => {
|
||||
this.buffer = Buffer.concat([this.buffer, chunk]);
|
||||
|
||||
Reference in new issue
Block a user