From ef81659521bc5741f889277320437a93c68aa869 Mon Sep 17 00:00:00 2001 From: Agzamus Date: Sun, 20 Sep 2026 03:08:33 +0300 Subject: [PATCH] chore(http): log failed requests only Per-request GET success logs (39 long URLs per teacher sync) flood the 2MB logcat buffer together with system ZeroHung spam, drowning the real kill reason (am_proc_died / lowmemorykiller). Log only non-2xx responses. --- .../main/java/agzam/vyatsu/data/remote/VyatsuHttpClient.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/agzam/vyatsu/data/remote/VyatsuHttpClient.kt b/app/src/main/java/agzam/vyatsu/data/remote/VyatsuHttpClient.kt index c71d7c6..3a76de4 100644 --- a/app/src/main/java/agzam/vyatsu/data/remote/VyatsuHttpClient.kt +++ b/app/src/main/java/agzam/vyatsu/data/remote/VyatsuHttpClient.kt @@ -22,7 +22,7 @@ object VyatsuHttpClient { suspend fun getText(url: String): String = withContext(Dispatchers.IO) { client.newCall(Request.Builder().url(url).build()).execute().use { resp -> - Log.d(TAG, "GET $url -> ${resp.code}") + if (!resp.isSuccessful) Log.e(TAG, "GET $url -> HTTP ${resp.code}") check(resp.isSuccessful) { "HTTP ${resp.code} for $url" } resp.body!!.string() } @@ -30,7 +30,7 @@ object VyatsuHttpClient { suspend fun getBytes(url: String): ByteArray = withContext(Dispatchers.IO) { client.newCall(Request.Builder().url(url).build()).execute().use { resp -> - Log.d(TAG, "GET $url -> ${resp.code}") + if (!resp.isSuccessful) Log.e(TAG, "GET $url -> HTTP ${resp.code}") check(resp.isSuccessful) { "HTTP ${resp.code} for $url" } resp.body!!.bytes() } @@ -42,7 +42,7 @@ object VyatsuHttpClient { */ suspend fun openStream(url: String): InputStream = withContext(Dispatchers.IO) { val resp = client.newCall(Request.Builder().url(url).build()).execute() - Log.d(TAG, "GET $url -> ${resp.code}") + if (!resp.isSuccessful) Log.e(TAG, "GET $url -> HTTP ${resp.code}") check(resp.isSuccessful) { "HTTP ${resp.code} for $url" } resp.body!!.byteStream() }