remove update caching
This commit is contained in:
+2
-8
@@ -29,18 +29,13 @@ class BackendUpdateFetcher(
|
||||
private val dispatcherProvider: DispatcherProvider,
|
||||
private val userId: Long
|
||||
) : UpdateFetcher {
|
||||
private var config: UpdateInfo? = null
|
||||
private var updateFile: File? = null
|
||||
|
||||
override suspend fun fetch(versionCode: Long): UpdateInfo = withContext(dispatcherProvider.io) {
|
||||
config?.let { return@withContext it }
|
||||
val configPath = envFetcher.get("UPDATE_CONFIG")
|
||||
if (configPath.isBlank()) {
|
||||
UpdateInfo()
|
||||
} else {
|
||||
json.decodeFromString<UpdateInfo>(File(configPath).readText()).apply {
|
||||
config = this
|
||||
}
|
||||
json.decodeFromString<UpdateInfo>(File(configPath).readText())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +43,7 @@ class BackendUpdateFetcher(
|
||||
val updateFilePath = envFetcher.get("UPDATE_FILE")
|
||||
if (updateFilePath.isBlank()) throw HttpException(HttpStatusCode.NotFound.value, "Update not found")
|
||||
val file = File(updateFilePath)
|
||||
if (!file.exists()) error("File not exists")
|
||||
updateFile = file
|
||||
if (!file.exists()) throw HttpException(HttpStatusCode.NotFound.value, "Update not exists")
|
||||
file
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user