@@ -253,6 +253,9 @@ public interface MutableSharedFlow<T> : SharedFlow<T>, FlowCollector<T> {
253
253
* @param replay the number of values replayed to new subscribers (cannot be negative, defaults to zero).
254
254
* @param extraBufferCapacity the number of values buffered in addition to `replay`.
255
255
* [emit][MutableSharedFlow.emit] does not suspend while there is a buffer space remaining (optional, cannot be negative, defaults to zero).
256
+ * The buffer size (as a whole) impacts emitters. The exact consequence of a full buffer depends on onBufferOverflow,
257
+ * but this buffer size can be used to control backpressure on emitters (slowing them down) or how we drop messages.
258
+ * With a larger buffer, you can allow emitters to have bursts of emissions without slowing them down, like any regular buffer.
256
259
* @param onBufferOverflow configures an [emit][MutableSharedFlow.emit] action on buffer overflow. Optional, defaults to
257
260
* [suspending][BufferOverflow.SUSPEND] attempts to emit a value.
258
261
* Values other than [BufferOverflow.SUSPEND] are supported only when `replay > 0` or `extraBufferCapacity > 0`.
@@ -263,7 +266,7 @@ public interface MutableSharedFlow<T> : SharedFlow<T>, FlowCollector<T> {
263
266
@Suppress(" FunctionName" , " UNCHECKED_CAST" )
264
267
public fun <T > MutableSharedFlow (
265
268
replay : Int = 0,
266
- extraBufferCapacity : Int = 0 ,
269
+ extraBufferCapacity : Int = 1 ,
267
270
onBufferOverflow : BufferOverflow = BufferOverflow .SUSPEND
268
271
): MutableSharedFlow <T > {
269
272
require(replay >= 0 ) { " replay cannot be negative, but was $replay " }
0 commit comments