Skip to content
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

Asynchronous request handling #77

Open
ShaunMaher opened this issue May 12, 2023 · 1 comment
Open

Asynchronous request handling #77

ShaunMaher opened this issue May 12, 2023 · 1 comment

Comments

@ShaunMaher
Copy link

Hello.

Would it be possible to make RestPS handle requests asynchronously?

Imagine I have a dummy endpoint script that just does the following:

Start-Sleep -Seconds 30
Return "Wake Up"

If this endpoint is triggered, the /endpoint/status endpoint (and all other endpoints) also stop responding until the 30 second sleep is complete.

I'm no powershell expert like you kind folks but I did a little reading.

There is a "HttpListener.GetContextAsync" method but that just let's do do other things until the request context is ready. Apply timeouts, etc. It doesn't run the response generation logic Async.

Maybe, once you have a Context (Start-RestPSListener.ps1:80) you could pass off to a Job that does everything from Start-RestPSListener.ps1:85 to 163 so the loop that starts on Start-RestPSListener.ps1:75 could immediately get ready to "Invoke-GetContext" the next incoming (parallel) request. I dunno. I'm just guessing.

Cheers.
Shaun.

@jpsider
Copy link
Owner

jpsider commented May 12, 2023

This is a duplicate of #64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants