Repository navigation
⚡ concurrent execution of async disposers in DisposableBag - #29
Conversation
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Updates DisposableBag.dispose to collect futures returned by disposers and await them concurrently using Future.wait, rather than sequentially awaiting each async disposer. Exception handling is maintained by attaching onError callbacks to record any async errors before throwing DisposableBagException. Co-authored-by: esenmx <43244505+esenmx@users.noreply.github.com>
…ndexing Drop the nullable futures juggling, record each disposer's error in a slot keyed by its registration index so DisposableBagException.errors stays in registration order, and document the invoke-in-order / await-together contract in the class and dispose() dartdoc. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…oracles Cover concurrent start, every-async-error collection, and mixed sync/async error ordering deterministically. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0eb65e9 to
261ec3e
Compare
💡 What:
Optimized
DisposableBag.disposeto collectFutures returned by async disposers and await them concurrently usingFuture.wait(futures), capturing both synchronous and asynchronous errors intoDisposableBagException.🎯 Why:
Previously,
DisposableBag.disposeawaited each asynchronous disposer sequentially in aforloop. If multiple disposers contained asynchronous work (e.g. flushing streams, closing network connections, finishing timers), each disposer had to wait for the previous one to complete, resulting in total disposal duration equal to the sum of all disposer execution times ($O(\sum t_i)$). Executing them concurrently reduces total disposal time to the duration of the slowest disposer ($\max(t_i)$).📊 Measured Improvement:
DisposableBagwith 10 asynchronous disposers delaying 10ms each.PR created automatically by Jules for task 1763264514431639548 started by @esenmx