From 06192419cba9e8b22c1cd17c178a4af7118e5906 Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 6 Jun 2020 16:28:34 -0400 Subject: [PATCH] using runblocking for MAL intercept since scope launches will run async --- .../data/track/myanimelist/MyAnimeListInterceptor.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt index 2a6c2720a3..192f5ec672 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt @@ -3,7 +3,7 @@ package eu.kanade.tachiyomi.data.track.myanimelist import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job -import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking import okhttp3.Interceptor import okhttp3.Request import okhttp3.RequestBody @@ -17,14 +17,14 @@ class MyAnimeListInterceptor(private val myanimelist: MyAnimeList) : Interceptor val scope = CoroutineScope(Job() + Dispatchers.Main) override fun intercept(chain: Interceptor.Chain): Response { - scope.launch { + runBlocking { myanimelist.ensureLoggedIn() } val request = chain.request() var response = chain.proceed(updateRequest(request)) if (response.code == 400) { - scope.launch { + runBlocking { myanimelist.refreshLogin() } response.close()