remove update caching

This commit is contained in:
2026-07-26 12:00:30 +03:00
parent 78cc178f26
commit d2e00692a6
@@ -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
}
}