Skip to content

Commit 0c5128f

Browse files
author
derklaro
committed
chore: always update collected servers if more servers were found than in the previous run
1 parent af684fe commit 0c5128f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

info-collector/src/main/java/tools/simrail/backend/collector/server/SimRailServerCollector.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ public void collectServerInformation() throws Exception {
9999
// collect further information about the server, such as the timezone
100100
// on every second collection run (every 60 seconds)
101101
var errorDuringCollect = false;
102+
var oldServerCount = this.collectedServers.size();
102103
var fullCollection = this.collectionRuns++ % 2 == 0;
103-
var collectionRequired = this.collectedServers.isEmpty();
104104

105105
var response = this.panelApiClient.getServers();
106106
var servers = response.getEntries();
@@ -231,7 +231,8 @@ public void collectServerInformation() throws Exception {
231231
}
232232
}
233233

234-
if (fullCollection && (collectionRequired || !errorDuringCollect)) {
234+
var collectedServerCount = foundServers.size();
235+
if (fullCollection && (collectedServerCount > oldServerCount || !errorDuringCollect)) {
235236
// update the found servers during the run to make them available to readers
236237
// only do this if no error was encountered during collection or collection
237238
// being necessary due to no servers being found previously

0 commit comments

Comments
 (0)