添加协程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()) {
suspendCoroutine<Unit> {
notify.set(it)
subscription.request(bufSize.toLong())
override suspend fun hasNext(): Boolean {
if (cache.isEmpty() && !compete) {
suspendCoroutine<Unit> {
notify.set(it)
subscription.request(bufSize.toLong())
}
}
!compete
} else {
!compete
return cache.isNotEmpty()
}
}
publisher.subscribe(subscriber)