Skip to content

Commit 90fd4bf

Browse files
committed
修复async操作符异步任务失效问题
1 parent 2cede22 commit 90fd4bf

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

rxhttp/src/main/java/rxhttp/IAwait.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package rxhttp
22

3-
import kotlinx.coroutines.*
3+
import kotlinx.coroutines.CoroutineScope
4+
import kotlinx.coroutines.Deferred
5+
import kotlinx.coroutines.async
46
import rxhttp.wrapper.await.*
57

68
/**
@@ -42,7 +44,7 @@ fun <T> IAwait<T>.delay(delay: Long): IAwait<T> = AwaitDelay(this, delay)
4244

4345
fun <T> IAwait<T>.startDelay(delay: Long): IAwait<T> = AwaitStartDelay(this, delay)
4446

45-
suspend fun <T> IAwait<T>.async() = supervisorScope { async { await() } }
47+
suspend fun <T> IAwait<T>.async(scope: CoroutineScope) = scope.async { await() }
4648

4749
suspend fun <T> Deferred<T>.tryAwait() = tryAwait { await() }
4850

0 commit comments

Comments
 (0)