Fix backup restore service concurrent modification crash on timeout.

This commit is contained in:
Cody Henthorne
2025-12-16 09:13:49 -05:00
committed by jeffrey-signal
parent 1bd5b03636
commit 15677c663b

View File

@@ -161,7 +161,7 @@ class BackupMediaRestoreService : SafeForegroundService() {
private fun stopDueToTimeout() {
controllerLock.withLock {
hasTimedOut = true
controllers.forEach { it.closeFromTimeout() }
controllers.clear()
stop(context = this, fromTimeout = true)
}
@@ -180,12 +180,6 @@ class BackupMediaRestoreService : SafeForegroundService() {
val totalBytes: ByteSize
get() = ArchiveRestoreProgress.state.totalRestoreSize
fun closeFromTimeout() {
controllerLock.withLock {
controllers.remove(this)
}
}
override fun close() {
controllerLock.withLock {
controllers.remove(this)