Revert "feat: retry конвертации (2 попытки) при failed/error"

This reverts commit cbcd22f09c.
This commit is contained in:
2026-08-21 12:08:57 +03:00
parent cbcd22f09c
commit ee86b9dc50
@@ -85,34 +85,10 @@ fun DetailsScreen(
mirrorStatus = runCatching { app.mirror.mirrorByItem(item.Id) }.getOrNull() mirrorStatus = runCatching { app.mirror.mirrorByItem(item.Id) }.getOrNull()
mirrorJob = runCatching { app.mirror.list(limit = 500).firstOrNull { it.itemId == item.Id } }.getOrNull() mirrorJob = runCatching { app.mirror.list(limit = 500).firstOrNull { it.itemId == item.Id } }.getOrNull()
loading = false loading = false
var retryCount = 0 while (mirrorStatus?.status == "processing" || mirrorStatus?.status == "queued") {
while (true) { delay(3_000)
when (mirrorStatus?.status) { mirrorStatus = runCatching { app.mirror.mirrorByItem(item.Id) }.getOrNull()
"processing", "queued" -> { mirrorJob = runCatching { app.mirror.list(limit = 500).firstOrNull { it.itemId == item.Id } }.getOrNull()
delay(3_000)
mirrorStatus = runCatching { app.mirror.mirrorByItem(item.Id) }.getOrNull()
mirrorJob = runCatching { app.mirror.list(limit = 500).firstOrNull { it.itemId == item.Id } }.getOrNull()
retryCount = 0
}
"done" -> {
break
}
"failed", "error" -> {
if (retryCount < 2) {
retryCount++
log("mirror", "конвертация упала, retry $retryCount/2 для ${item.Id}")
runCatching { app.mirror.createMirror(item.Id) }
.onSuccess { refreshKey++ }
.onFailure { e -> log("mirror", "retry $retryCount не удался: ${e.message}") }
delay(5_000)
} else {
break
}
}
else -> {
break
}
}
} }
} }