Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bufferIntrospective emits at most Platform.recommendedBatchSize elements #1832

Open
Jasper-M opened this issue Apr 18, 2024 · 0 comments
Open

Comments

@Jasper-M
Copy link

The documentation says:

Buffers signals while busy, after which it emits the buffered events as a single bundle.

But in fact it emits at most 1024 elements at a time on the JVM, keeping the excess elements in the buffer.

scala> @volatile var count = 0
var count: Int = 0

scala> Observable.repeatEvalF(Task{count += 1})
     |   .bufferIntrospective(5000)
     |   .take(5)
     |   .mapEval(buffer => Task.sleep(2.seconds) >> Task(println(s"got ${buffer.size} elements")))
     |   .completedL
     |   .runSyncUnsafe()
got 177 elements
got 333 elements
got 1024 elements
got 1024 elements
got 1024 elements

scala> count
val res27: Int = 8193
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant