mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 18:51:51 +01:00
using runblocking for MAL intercept
since scope launches will run async
This commit is contained in:
parent
8ce1d94fd2
commit
06192419cb
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user