mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Do not overload analytics server if entity arrays get too big
This commit is contained in:
parent
a110abc192
commit
91e713fc00
@ -23,7 +23,7 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
|||||||
initialize() {
|
initialize() {
|
||||||
this.syncKey = null;
|
this.syncKey = null;
|
||||||
|
|
||||||
setInterval(() => this.sendTimePoints(), 30 * 1000);
|
setInterval(() => this.sendTimePoints(), 120 * 1000);
|
||||||
|
|
||||||
// Retrieve sync key from player
|
// Retrieve sync key from player
|
||||||
return this.app.storage.readFileAsync(analyticsLocalFile).then(
|
return this.app.storage.readFileAsync(analyticsLocalFile).then(
|
||||||
@ -158,6 +158,8 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
|||||||
|
|
||||||
const entities = root.entityMgr.getAllWithComponent(StaticMapEntityComponent);
|
const entities = root.entityMgr.getAllWithComponent(StaticMapEntityComponent);
|
||||||
|
|
||||||
|
// Limit the entities
|
||||||
|
if (entities.length < 5000) {
|
||||||
for (let i = 0; i < entities.length; ++i) {
|
for (let i = 0; i < entities.length; ++i) {
|
||||||
const entity = entities[i];
|
const entity = entities[i];
|
||||||
const staticComp = entity.components.StaticMapEntity;
|
const staticComp = entity.components.StaticMapEntity;
|
||||||
@ -179,6 +181,7 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
|||||||
}
|
}
|
||||||
staticEntities.push(payload);
|
staticEntities.push(payload);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
storedShapes: root.hubGoals.storedShapes,
|
storedShapes: root.hubGoals.storedShapes,
|
||||||
|
Loading…
Reference in New Issue
Block a user