performance: Don't calc checksum for non-multiplayer games, no one cares if you hack your own game

This commit is contained in:
Yair Morgenstern 2023-09-05 18:52:42 +03:00
parent a2fa4cebf4
commit 5cc57f9293
2 changed files with 6 additions and 8 deletions

View File

@ -37,7 +37,6 @@ import java.io.PrintWriter
import java.io.StringWriter
import java.io.Writer
import java.time.Duration
import java.util.Arrays
import java.util.GregorianCalendar
import java.util.concurrent.TimeUnit
@ -69,13 +68,12 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
private const val FILE_STORAGE = "FILE_STORAGE"
private const val AUTH_HEADER = "AUTH_HEADER"
private val constraints = Constraints.Builder()
// If no internet is available, worker waits before becoming active.
.setRequiredNetworkType(NetworkType.CONNECTED)
.build()
fun enqueue(appContext: Context, delay: Duration, inputData: Data) {
val constraints = Constraints.Builder()
// If no internet is available, worker waits before becoming active.
.setRequiredNetworkType(NetworkType.CONNECTED)
.build()
val checkTurnWork = OneTimeWorkRequestBuilder<MultiplayerTurnCheckWorker>()
.setConstraints(constraints)
.setInitialDelay(delay.seconds, TimeUnit.SECONDS)

View File

@ -372,7 +372,7 @@ class UncivFiles(
}
/** Returns gzipped serialization of [game], optionally gzipped ([forceZip] overrides [saveZipped]) */
fun gameInfoToString(game: GameInfo, forceZip: Boolean? = null, updateChecksum:Boolean=true): String {
fun gameInfoToString(game: GameInfo, forceZip: Boolean? = null, updateChecksum:Boolean=false): String {
game.version = GameInfo.CURRENT_COMPATIBILITY_VERSION
if (updateChecksum) game.checksum = game.calculateChecksum()