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

Add shutdown timeout #39

Merged
merged 1 commit into from
Sep 8, 2023
Merged

Add shutdown timeout #39

merged 1 commit into from
Sep 8, 2023

Conversation

Baccata
Copy link
Contributor

@Baccata Baccata commented Sep 8, 2023

Otherwise it may take up to 30 seconds for it to stop after pressing enter.

@@ -42,11 +43,11 @@ object Main extends IOApp.Simple {
.withPort(thePort)
.withHost(theHost)
.withHttpApp(routes.orNotFound)
.withShutdownTimeout(1.second)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: You can even set it to zero :)

.build
.productL(IO.println(message).toResource)
}
.useForever
.race(IO.readLine)
.surround(IO.readLine)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: slight change of semantics, this makes it so that you can only cancel with a readLine once the resource has been allocated. Previously, if the resource is cancelable, you could prevent the server from even starting. I'm not sure if it matters for Ember though.

@Baccata Baccata merged commit f93a2c8 into main Sep 8, 2023
2 checks passed
@Baccata Baccata deleted the shutdown-timeout branch September 8, 2023 10:52
@daddykotex
Copy link
Contributor

Otherwise it may take up to 30 seconds for it to stop after pressing enter.

yes that's super annoying, but I don't understand why it takes 30 seconds to shutdown a server that has no outstanding connections (or maybe one?), there must be an issue

@kubukoz
Copy link
Member

kubukoz commented Sep 11, 2023

QQ, are you ever seeing this before making requests? I saw these shutdowns taking lots of time after I'd made requests from the browser, but closing the browser would kill any outstanding connections and IIRC it would help.

@daddykotex
Copy link
Contributor

QQ, are you ever seeing this before making requests? I saw these shutdowns taking lots of time after I'd made requests from the browser, but closing the browser would kill any outstanding connections and IIRC it would help.

I can't recall if it was happening after an interaction w/ the browser or not, I'll try to see

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

Successfully merging this pull request may close these issues.

3 participants