From c2acbd0eae181f0530dd9748bb71b9672890ff87 Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Sat, 3 Oct 2026 05:58:31 +0000 Subject: [PATCH] downloads: skip redundant progress writes --- .../kotlin/com/subtracks/data/repo/DownloadRepository.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/subtracks/data/repo/DownloadRepository.kt b/app/src/main/kotlin/com/subtracks/data/repo/DownloadRepository.kt index bdc1257d..1cacf94c 100644 --- a/app/src/main/kotlin/com/subtracks/data/repo/DownloadRepository.kt +++ b/app/src/main/kotlin/com/subtracks/data/repo/DownloadRepository.kt @@ -543,7 +543,7 @@ class DownloadRepository( EngineStatus.Failed -> DownloadStatus.Failed } if (status == DownloadStatus.Failed) file.delete() - db.downloadDao().upsert( + val updated = row.copy( status = status, bytes = state.bytes, @@ -561,8 +561,8 @@ class DownloadRepository( } else { row.downloadedAt }, - ), - ) + ) + if (updated != row) db.downloadDao().upsert(updated) } private suspend fun markFailed(