diff --git a/apps/vbox/backend/src/main/kotlin/ru/shadowsparky/vbox/backend/data/BackendUpdateFetcher.kt b/apps/vbox/backend/src/main/kotlin/ru/shadowsparky/vbox/backend/data/BackendUpdateFetcher.kt index 90f0f49..12be940 100644 --- a/apps/vbox/backend/src/main/kotlin/ru/shadowsparky/vbox/backend/data/BackendUpdateFetcher.kt +++ b/apps/vbox/backend/src/main/kotlin/ru/shadowsparky/vbox/backend/data/BackendUpdateFetcher.kt @@ -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(File(configPath).readText()).apply { - config = this - } + json.decodeFromString(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 } }