ui: add basic double update guard

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2023-05-15 18:22:12 +02:00
parent d883802178
commit f2d166a6a4

View File

@ -312,13 +312,18 @@ object Updater {
session.close()
}
private var updating = false
private suspend fun downloadAndUpdateWrapErrors() {
if (updating)
return
updating = true
try {
downloadAndUpdate()
} catch (e: Throwable) {
Log.e(TAG, "Update failure", e)
emitProgress(Progress.Failure(e))
}
updating = false
}
private class InstallReceiver : BroadcastReceiver() {