[🚀 Feature]: [dotnet] [bidi] opt-in parallel event handler execution

Open
#18,301 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp

Research direction

Start by locating the .NET BiDi event subscription implementation and the IEventSource<T> and IBiDi interfaces named in the proposed API. Trace how subscriptions invoke handlers and drain work during disposal, then check the related subscription tests. Done means an opt-in concurrency setting or equivalent API is implemented with the stated ordering, failure propagation, and disposal behavior clarified and covered by tests.

Written by the indexing model from the issue text.

Description

A-needs-triaging I-enhancement
Description

BiDi event handlers run serially per subscription: one worker awaits each handler before taking the next event. Good default (ordered, isolated, drains on dispose), but throughput is bounded by handler latency.

50 console.log events with a 100 ms handler take ~5 s; with 8 concurrent handlers ~0.7 s.

Users wanting concurrency today must fire-and-forget inside the handler (losing failure propagation and drain-on-dispose) or write a custom StreamAsync() consumer.

Have you considered any alternatives or workarounds?

Opt in to invoke handlers parallelizable.

Proposed API
public sealed class SubscribeOptions
{
    public int MaxConcurrency { get; set; } = 1;
}

// new overloads on IEventSource<T> (and IBiDi)
Task<ISubscription> SubscribeAsync(Func<T, Task> handler, SubscribeOptions options, CancellationToken ct = default);
Task<ISubscription> SubscribeAsync(Action<T> handler, SubscribeOptions options, CancellationToken ct = default);

Or something like chaining handlers:

source.WithParallel(8).SubscribeAsync(handler)
Dominant language
Java
Stars
34.6k
Forks
8.7k
Avg merge
1d 16h
Merged PRs (30d)
107

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SeleniumHQ/selenium

All issues in SeleniumHQ/selenium

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.