mirror of
https://github.com/InsanusMokrassar/SauceNaoAPI.git
synced 2024-12-23 05:07:12 +00:00
hotfix
This commit is contained in:
parent
270be95784
commit
69bfa56692
@ -16,8 +16,7 @@ import io.ktor.utils.io.core.Input
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlin.coroutines.Continuation
|
||||
import kotlin.coroutines.suspendCoroutine
|
||||
import kotlin.coroutines.*
|
||||
|
||||
private const val API_TOKEN_FIELD = "api_key"
|
||||
private const val OUTPUT_TYPE_FIELD = "output_type"
|
||||
@ -60,7 +59,7 @@ data class SauceNaoAPI(
|
||||
launch {
|
||||
try {
|
||||
val answer = makeRequest(requestBuilder)
|
||||
callback.resumeWith(Result.success(answer))
|
||||
callback.resume(answer)
|
||||
|
||||
quotaManager.updateQuota(answer.header, timeManager)
|
||||
} catch (e: TooManyRequestsException) {
|
||||
@ -68,7 +67,7 @@ data class SauceNaoAPI(
|
||||
requestsChannel.send(callback to requestBuilder)
|
||||
} catch (e: Exception) {
|
||||
try {
|
||||
callback.resumeWith(Result.failure(e))
|
||||
callback.resume(e)
|
||||
} catch (e: IllegalStateException) { // may happen when already resumed and api was closed
|
||||
// do nothing
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user