I have a simple code that executes some task periodically using:
Flux.interval(Duration.ZERO, interval, scheduler)
Sometimes (rarely) I see the following error being issued:
Could not emit tick 4218 due to lack of requests (interval doesn't support small downstream requests that replenish slower than the ticks)
Looking at the source code I'm not able to understand what does it mean. Can someone explain? Also it would be great if someone could help me with a code snippet that reproduces this issue.
Thanks
It essentially means that some code in the chain is too slow to process the emitted element(s) in time. Take this stream for example:
Flux.interval(Duration.ofSeconds(1)) //emit every second
.map(i -> {
//do something that takes 2 seconds
})
.subscribe();
Every second a new value is pushed to the stream. That is Reactor tries to do that, but the stream is still busy processing the previous value (which takes more than one second). Please note that this example is for illustration only and it may or may not reproduce your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With