添加协程mongo驱动

This commit is contained in:
tursom 2020-03-11 22:48:06 +08:00
parent 655aafdb27
commit 689490748e

View File

@ -173,14 +173,14 @@ class AsyncMongoOperator<T : Any>(
} }
} }
override suspend fun hasNext(): Boolean = if (cache.isEmpty()) { override suspend fun hasNext(): Boolean {
suspendCoroutine<Unit> { if (cache.isEmpty() && !compete) {
notify.set(it) suspendCoroutine<Unit> {
subscription.request(bufSize.toLong()) notify.set(it)
subscription.request(bufSize.toLong())
}
} }
!compete return cache.isNotEmpty()
} else {
!compete
} }
} }
publisher.subscribe(subscriber) publisher.subscribe(subscriber)