From 099b9b21dbba4576833377fc554023d7385d4bbf Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 25 Oct 2021 08:40:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/data/AppDatabase.kt | 1 + app/src/main/java/io/legado/app/data/entities/HttpTTS.kt | 2 +- .../main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/AppDatabase.kt b/app/src/main/java/io/legado/app/data/AppDatabase.kt index 9f3457204..5d645e824 100644 --- a/app/src/main/java/io/legado/app/data/AppDatabase.kt +++ b/app/src/main/java/io/legado/app/data/AppDatabase.kt @@ -86,6 +86,7 @@ abstract class AppDatabase : RoomDatabase() { db.execSQL("update book_sources set loginUi = null where loginUi = 'null'") db.execSQL("update rssSources set loginUi = null where loginUi = 'null'") db.execSQL("update httpTTS set loginUi = null where loginUi = 'null'") + db.execSQL("update httpTTS set concurrentRate = '0' where loginUi is null") } } diff --git a/app/src/main/java/io/legado/app/data/entities/HttpTTS.kt b/app/src/main/java/io/legado/app/data/entities/HttpTTS.kt index 77d8eee64..3b1db4512 100644 --- a/app/src/main/java/io/legado/app/data/entities/HttpTTS.kt +++ b/app/src/main/java/io/legado/app/data/entities/HttpTTS.kt @@ -18,7 +18,7 @@ data class HttpTTS( var name: String = "", var url: String = "", var contentType: String? = null, - override var concurrentRate: String? = null, + override var concurrentRate: String? = "0", override var loginUrl: String? = null, override var loginUi: String? = null, override var header: String? = null, diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index afce393e0..966cbb96a 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -285,9 +285,10 @@ class AnalyzeUrl( if (concurrentRate.isNullOrEmpty()) { return } - val fetchRecord = accessTime[source.getKey()] + var fetchRecord = accessTime[source.getKey()] if (fetchRecord == null) { - accessTime[source.getKey()] = FetchRecord(System.currentTimeMillis(), 1) + fetchRecord = FetchRecord(System.currentTimeMillis(), 1) + accessTime[source.getKey()] = fetchRecord return } val waitTime = synchronized(fetchRecord) {