Причина синхронизации и временная метка в логах

This commit is contained in:
2026-05-21 22:30:40 +03:00
parent d0f490a3fd
commit d3eac81660
14 changed files with 182 additions and 52 deletions

View File

@@ -4,6 +4,7 @@ import com.github.nullptroma.wallenc.domain.datatypes.StorageSyncPaths
import com.github.nullptroma.wallenc.domain.interfaces.IVaultsManager
import com.github.nullptroma.wallenc.ui.R
import com.github.nullptroma.wallenc.ui.resources.UiStringResolver
import com.github.nullptroma.wallenc.domain.tasks.StorageSyncTriggerReason
import com.github.nullptroma.wallenc.usecases.RunStorageSyncUseCase
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -61,7 +62,7 @@ class StorageSyncBootstrap @Inject constructor(
}
syncRunner.enqueue(
displayTitle = uiStrings(R.string.task_title_storage_sync_background),
logReason = "debounce",
reason = StorageSyncTriggerReason.Debounce,
)
}
}

View File

@@ -4,6 +4,7 @@ import android.content.Context
import androidx.hilt.work.HiltWorker
import androidx.work.CoroutineWorker
import androidx.work.WorkerParameters
import com.github.nullptroma.wallenc.domain.tasks.StorageSyncTriggerReason
import com.github.nullptroma.wallenc.usecases.RunStorageSyncUseCase
import dagger.assisted.Assisted
import dagger.assisted.AssistedInject
@@ -19,7 +20,7 @@ class StorageSyncWorker @AssistedInject constructor(
override suspend fun doWork(): Result {
Timber.d("Periodic storage sync started (attempt %d)", runAttemptCount)
return runCatching {
syncRunner.runBlocking()
syncRunner.runBlocking(StorageSyncTriggerReason.Background)
Timber.d("Periodic storage sync finished")
Result.success()
}.getOrElse { error ->