Open He-Pin opened 1 month ago
Update:
@InternalApi private[pekko] trait Buffer[T] {
def capacity: Int
def used: Int
def isFull: Boolean
def isEmpty: Boolean
def nonEmpty: Boolean
def enqueue(elem: T): Unit
def dequeue(): T
def peek(): T
def clear(): Unit
def dropHead(): Unit
def dropTail(): Unit
}
as the current Buffer
's clear
, dropHead
and dropTail
just returns Unit
, change it to returns
Seq[T]
or T
will help , but that can involve: 1. large amount of change across the codebase, 2. hurt performance for clear
case.
So seems better to just add a new dedicated implementation with onBackPressureDrop
as reactor-core?
Motivation:
I want to do some rate limiting and just fail the single task, eg when combined with
mapAsync
. Currently seems I can't observe the backpressure.onBackpressure
is only been called once downstream backpressure.What do you think?
In reactor-core, there is:
reactor.core.publisher.Flux#onBackpressureDrop(java.util.function.Consumer<? super T>)
This is what I would like to make use.