Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1446165 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[kairos] uncap transaction scheduler channel" into main

parents e21fcb2f 811754a0
Loading
Loading
Loading
Loading
+4 −8
Original line number Original line Diff line number Diff line
@@ -74,7 +74,7 @@ internal class Network(
    private val muxMovers = ArrayDeque<MuxDeferredNode<*, *, *>>()
    private val muxMovers = ArrayDeque<MuxDeferredNode<*, *, *>>()
    private val deactivations = ArrayDeque<PushNode<*>>()
    private val deactivations = ArrayDeque<PushNode<*>>()
    private val outputDeactivations = ArrayDeque<Output<*>>()
    private val outputDeactivations = ArrayDeque<Output<*>>()
    private val inputScheduleChan = Channel<ScheduledAction<*>>()
    private val inputScheduleChan = Channel<ScheduledAction<*>>(Channel.UNLIMITED)


    override fun scheduleOutput(output: Output<*>) {
    override fun scheduleOutput(output: Output<*>) {
        fastOutputs.add(output)
        fastOutputs.add(output)
@@ -169,14 +169,10 @@ internal class Network(
                onResult.cancel()
                onResult.cancel()
                return@also
                return@also
            }
            }
            val job =
            inputScheduleChan.trySend(
                coroutineScope.launch {
                    inputScheduleChan.send(
                ScheduledAction(reason, onStartTransaction = block, onResult = onResult)
                ScheduledAction(reason, onStartTransaction = block, onResult = onResult)
            )
            )
        }
        }
            onResult.invokeOnCompletion { job.cancel() }
        }


    inline fun <R> runThenDrainDeferrals(block: () -> R): R =
    inline fun <R> runThenDrainDeferrals(block: () -> R): R =
        block().also { deferScopeImpl.drainDeferrals() }
        block().also { deferScopeImpl.drainDeferrals() }