Use duration overload for time related methods
This commit is contained in:
@@ -91,7 +91,7 @@ class DownloadCache(
|
||||
|
||||
private val _isInitializing = MutableStateFlow(false)
|
||||
val isInitializing = _isInitializing
|
||||
.debounce(1000L) // Don't notify if it finishes quickly enough
|
||||
.debounce(1.seconds) // Don't notify if it finishes quickly enough
|
||||
.stateIn(scope, SharingStarted.WhileSubscribed(), false)
|
||||
|
||||
private val diskCacheFile: File
|
||||
@@ -433,7 +433,7 @@ class DownloadCache(
|
||||
private fun updateDiskCache() {
|
||||
updateDiskCacheJob?.cancel()
|
||||
updateDiskCacheJob = scope.launchIO {
|
||||
delay(1000)
|
||||
delay(1.seconds)
|
||||
ensureActive()
|
||||
val bytes = ProtoBuf.encodeToByteArray(rootDownloadsDir)
|
||||
ensureActive()
|
||||
|
||||
@@ -60,6 +60,7 @@ import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.io.File
|
||||
import java.util.Locale
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
/**
|
||||
* This class is the one in charge of downloading chapters.
|
||||
@@ -502,7 +503,7 @@ class Downloader(
|
||||
// Retry 3 times, waiting 2, 4 and 8 seconds between attempts.
|
||||
.retryWhen { _, attempt ->
|
||||
if (attempt < 3) {
|
||||
delay((2L shl attempt.toInt()) * 1000)
|
||||
delay((2L shl attempt.toInt()).seconds)
|
||||
true
|
||||
} else {
|
||||
false
|
||||
|
||||
@@ -17,6 +17,7 @@ import tachiyomi.domain.manga.model.Manga
|
||||
import tachiyomi.domain.source.service.SourceManager
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
data class Download(
|
||||
val source: HttpSource,
|
||||
@@ -47,7 +48,7 @@ data class Download(
|
||||
if (pages == null) {
|
||||
emit(0)
|
||||
while (pages == null) {
|
||||
delay(50)
|
||||
delay(50.milliseconds)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +56,7 @@ data class Download(
|
||||
emitAll(combine(progressFlows) { it.average().toInt() })
|
||||
}
|
||||
.distinctUntilChanged()
|
||||
.debounce(50)
|
||||
.debounce(50.milliseconds)
|
||||
|
||||
val progress: Int
|
||||
get() {
|
||||
|
||||
Reference in New Issue
Block a user