fix records being overwritten at boot

This commit is contained in:
Nick Krecklow 2020-04-21 18:51:29 -05:00
parent 2a3f177826
commit e226066a61
No known key found for this signature in database
GPG Key ID: 5F149FDE156FFA94
4 changed files with 6 additions and 11 deletions

View File

@ -1,3 +1,6 @@
**5.1.1** *(Apr 21 2020)*
- Fixes records being overwritten after boot. This bug did not corrupt saves and is only a visual error.
**5.1.0** *(Apr 21 2020)*
- Completely rebuilt the backend. This includes several optimizations, code cleanup and syncing fixes. Its code model now pairs nicely with the frontend's Javascript model.

View File

@ -10,7 +10,6 @@ class ServerRegistration {
constructor (data) {
this.data = data
this._pingHistory = []
this._hasInitialRecordData = false
}
getUpdate (timestamp, resp, err, version) {
@ -27,14 +26,7 @@ class ServerRegistration {
update.versions = this.versions
}
// Validate that we have logToDatabase enabled otherwise in memory pings
// will create a record that's only valid for the runtime duration.
if (config.logToDatabase && (!this._hasInitialRecordData || !this.recordData || resp.players.online > this.recordData.playerCount)) {
// For instances with existing data, recordData will be defined at boot
// This causes initial updates to NOT include recordData since it hasn't changed
// This flag force includes it to avoid "late loading"
this._hasInitialRecordData = true
if (config.logToDatabase && (!this.recordData || resp.players.online > this.recordData.playerCount)) {
this.recordData = {
playerCount: resp.players.online,
timestamp: timestamp

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "minetrack",
"version": "5.0.0",
"version": "5.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "minetrack",
"version": "5.1.0",
"version": "5.1.1",
"description": "A Minecraft server tracker that lets you focus on the basics.",
"main": "main.js",
"dependencies": {