-
Notifications
You must be signed in to change notification settings - Fork 621
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
suggestion: getAvailablePort()
#3279
Comments
Although use cases are obvious if one has engaged in the related topics, I think an explainer is useful for each (and also that this is probably better-suited for a discussion topic than an issue). |
I've just updated the description with use cases. Regarding issue vs. discussion: it seems I'm unable to convert this issue into a discussion. Would someone with the necessary permissions please do so. |
I like I don't see the use case of |
I'm of a similar opinion. Yeah, I can't think of a use case for |
PRs are welcome. |
On second thought, I don't think these functions are the best approach. Instead of using And instead of using import { retry } from "https://deno.land/[email protected]/async/retry.ts";
await retry(async () => await Deno.connect({ port: 8000 })); |
It's useful if someone needs to specify the port for other parts of a program before actually opening the connection. Good point re using |
port.getAvailable()
and port.ready()
port.getAvailable()
port.getAvailable()
getAvailablePort()
Are any of the following utilities good candidates for inclusion?
withSignal
Run an async function by passing in a fresh abort controller's signal. Upon completion, abort.
Use case: ensuring that the resolution of a promise triggers the abort, which may trigger other things.
port.getAvailable
Determine an open port.
Use case: get an unused port when launching processes that allow for specificity of port.
port.ready
Poll whether a given port can be connected to
Use case: determine whether a server is prepared to accept connections.
The text was updated successfully, but these errors were encountered: