-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dotnet] Propagate service asynchronicity to the command executor. #15246
base: trunk
Are you sure you want to change the base?
[dotnet] Propagate service asynchronicity to the command executor. #15246
Conversation
PR Reviewer Guide 🔍(Review updated until commit 3d085be)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 3d085be
Previous suggestionsSuggestions up to commit 8fc36d2
|
Mass test failures. I think this is failing because we are @nvborisenko Is it OK if we make Since it is public, can we add an |
DriverService.Start()
thread-safe
PR has been updated, my previous initiative has been scrapped in favor of an incremental improvement: true async |
|
if (this.driverServiceProcess is null)
{
var driverServiceProcess = new Process(); Should be |
I simplified the thread-safety so now I can do this. The PR now waits for initialization even if the process has been set. |
The general strategy was laid out in this older issue #14067 However, the new async method was just for the As part of making the driver service reusable in preparation for v5, I wanted to make the start/stop methods async. If we introduce those changes after v5, then users may start using the driver service type and the async methods will become a migration for them. |
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Now that the driver command execution is asynchronous (
async ExecuteAsync
), we can propagate the DriverStart
asynchronicity up to that method.Additionally (and separately) disposal of the
DriverService
now supportsIAsyncDisposable
. Usage will change as so:This does affect users: now, anyone who makes their own service (presumably power users) should asynchronously dispose the service. Luckily,
NUnit
andxUnit
both support async setup/cleanups (TODO doesMSTest
?)The current implementation keeps the old disposal implementation around, and probably should for some time.
Open Questions
Does
MSTest
support async teardown/one-time teardown?Should the disposal implementation be
[Obsolete]
?Motivation and Context
The
NewSession
command does sync-over-async, which is bad practice. Now that we haveasync ExecuteAsync
, that doesn't have to be the case.Types of changes
Checklist
PR Type
Enhancement, Other
Description
Introduced asynchronous methods for
DriverService
operations.StartAsync
andDisposeAsync
methods for asynchronous service handling.Start
andDispose
.Enhanced thread safety and error handling in
DriverService
.IsInitializedAsync
.WaitForServiceInitialization
toWaitForServiceInitializationAsync
.Updated
ICommandServer
interface to support asynchronous operations.StartAsync
method and implementedIAsyncDisposable
.Adjusted
DriverServiceCommandExecutor
to use asynchronous service start.Changes walkthrough 📝
DriverService.cs
Added asynchronous methods and improved thread safety in DriverService
dotnet/src/webdriver/DriverService.cs
StartAsync
,DisposeAsync
, andIsInitializedAsync
.initialization and disposal.
DriverServiceCommandExecutor.cs
Updated command executor to use asynchronous service start
dotnet/src/webdriver/Remote/DriverServiceCommandExecutor.cs
ExecuteAsync
to useStartAsync
for starting the service.ICommandServer.cs
Enhanced ICommandServer with asynchronous operations
dotnet/src/webdriver/Remote/ICommandServer.cs
StartAsync
method to support asynchronous server start.IAsyncDisposable
for asynchronous resource disposal.Start
method.