-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
KTOR-7359 Implement a suspending version of EmbeddedServer.start and EmbeddedServer.stop #4481
base: 3.1.0-eap
Are you sure you want to change the base?
Conversation
* Use stdlib `use` extension-function * Update type checks
Co-authored-by: Osip Fatkullin <[email protected]>
…torio#4411) * Drop `jvmAndNix` shared source set * Commonize `ktor-network` and `ktor-network-tls` * Support TCP and Unix sockets for wasm-js and js on Node * Move `supportsUnixDomainSockets` to posix and use Platform instead of expect/actual
* Support multiple client engines for JS/WasmJs * CIO client Js/WasmJs support * Enable CIO tests in client tests * Make client engines `data object` to have `toString` * Make ClientLoader work with multiple engines on js/wasmJs and so test CIO engine on nodejs(js+wasmJs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please check the CI?
* That's why we assign port after the server is started in [startServer] | ||
* Note: this means, that [port] can be used only after calling [createAndStartServer] or [startServer]. | ||
*/ | ||
private var _port: Int = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider extracting a constant for non initialized value and use a different value (other than default port)
@@ -101,7 +125,8 @@ actual constructor( | |||
// we start it on the global scope because we don't want it to fail the whole test | |||
// as far as we have retry loop on call side | |||
val starting = GlobalScope.async { | |||
server.start(wait = false) | |||
server.startSuspend(wait = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make an extension function here like server.listeningPorts()
Please check the code style problems |
Subsystem
Server
Motivation
Solution
Only
startSuspend
andstopSuspend
functions were added with minimal bridge for JVM and Native implementations.That was done like this, because in most cases users will anyway call
start
andstop
, and it's not clear, which engines could supportsuspend
start/stop (e.g CIO can, for sure, but for others it's not that clear).That's why minimally invasive changes were implemented to support wasm-js and js case, where
runBlocking
is not available.PR also contains changes to
EngineTestBase
for js and wasm-js as this is the main consumer for those new APIs.Note: probably some commonization is possible for both
EmbeddedServer
andEngineTestBase
, it should be investigated.