fix slow manga thumbnails issue, next manga reset page issue

This commit is contained in:
Aria Moradi
2021-05-17 14:22:24 +04:30
parent 57274a0a01
commit 9d38f478e3
5 changed files with 15 additions and 11 deletions
@@ -23,8 +23,9 @@ object CachedImageResponse {
}
private fun findFileNameStartingWith(directoryPath: String, fileName: String): String? {
val target = "$fileName."
File(directoryPath).listFiles().forEach { file ->
if (file.name.startsWith("$fileName."))
if (file.name.startsWith(target))
return "$directoryPath/${file.name}"
}
return null
@@ -36,9 +36,8 @@ import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupImport.restoreLegacyBac
import ir.armor.tachidesk.server.internal.About.getAbout
import ir.armor.tachidesk.server.util.openInBrowser
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.future.future
import kotlinx.coroutines.newFixedThreadPoolContext
import mu.KotlinLogging
import java.io.IOException
import java.text.SimpleDateFormat
@@ -55,7 +54,9 @@ import kotlin.concurrent.thread
object JavalinSetup {
private val logger = KotlinLogging.logger {}
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
@kotlinx.coroutines.ObsoleteCoroutinesApi
private val scope = CoroutineScope(newFixedThreadPoolContext(200, "javalin-future"))
private fun <T> future(block: suspend CoroutineScope.() -> T): CompletableFuture<T> {
return scope.future(block = block)