mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04:00
performance: Don't enqueue multiplayer game update for 0 games
This commit is contained in:
parent
855b2959a1
commit
4ddaf9b2c4
@ -190,6 +190,7 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
|
|||||||
fun startTurnChecker(applicationContext: Context, files: UncivFiles, currentGameInfo: GameInfo, settings: GameSettingsMultiplayer) {
|
fun startTurnChecker(applicationContext: Context, files: UncivFiles, currentGameInfo: GameInfo, settings: GameSettingsMultiplayer) {
|
||||||
Log.i(LOG_TAG, "startTurnChecker")
|
Log.i(LOG_TAG, "startTurnChecker")
|
||||||
|
|
||||||
|
// Games that haven't been updated in a week are considered stale
|
||||||
val oneWeekWorthOfMilliseconds = 1000*60*60*24*7
|
val oneWeekWorthOfMilliseconds = 1000*60*60*24*7
|
||||||
val gameFiles = files.getMultiplayerSaves()
|
val gameFiles = files.getMultiplayerSaves()
|
||||||
.filter { it.lastModified() > System.currentTimeMillis() - oneWeekWorthOfMilliseconds }
|
.filter { it.lastModified() > System.currentTimeMillis() - oneWeekWorthOfMilliseconds }
|
||||||
@ -209,6 +210,7 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
|
|||||||
//just skip one file
|
//just skip one file
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (count==0) return // no games to update
|
||||||
|
|
||||||
Log.d(LOG_TAG, "start gameNames: ${gameNames.contentToString()}")
|
Log.d(LOG_TAG, "start gameNames: ${gameNames.contentToString()}")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user