Skip to content

Add spec for HTTP::Server#close#5958

Merged
RX14 merged 1 commit intocrystal-lang:masterfrom
straight-shoota:jm/feature/http-server-gracefully-close
Sep 10, 2018
Merged

Add spec for HTTP::Server#close#5958
RX14 merged 1 commit intocrystal-lang:masterfrom
straight-shoota:jm/feature/http-server-gracefully-close

Conversation

@straight-shoota
Copy link
Copy Markdown
Member

This PR adds a spec for HTTP::Server#close that is shuts down gracefully and active requests can be finished.

See also #5957

@straight-shoota
Copy link
Copy Markdown
Member Author

straight-shoota commented Apr 17, 2018

For some reason on linux the spec fails when run together with the #listen specs in the same file. If those are skipped, it passes.

I have really no idea what side effect might influence this.

@straight-shoota
Copy link
Copy Markdown
Member Author

This has also popped up in #6027. It seems to be related to HTTP::Server#close closing the server sockets. I'll investigate further.

straight-shoota added a commit to straight-shoota/crystal that referenced this pull request Apr 30, 2018
chris-huxtable pushed a commit to chris-huxtable/crystal that referenced this pull request Jun 6, 2018
@straight-shoota straight-shoota force-pushed the jm/feature/http-server-gracefully-close branch from e7776ab to 0eed03c Compare September 4, 2018 22:17
@straight-shoota
Copy link
Copy Markdown
Member Author

The spec seems to pass now as intended. Maybe the issue that caused it to fail on linux was resolved in the mean time in another PR...

At least this spec can probably be merged now to detect regressions in the future.

@RX14 RX14 added this to the 0.27.0 milestone Sep 10, 2018
@RX14 RX14 merged commit 2314da4 into crystal-lang:master Sep 10, 2018
@straight-shoota straight-shoota deleted the jm/feature/http-server-gracefully-close branch September 10, 2018 19:23
ezrast pushed a commit to ezrast/crystal that referenced this pull request Oct 2, 2018
context.response.puts "foo"
context.response.flush

Fiber.yield
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is no doc for Fiber.yield, could you please explain how it works here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fiber.yield gives the scheduler the possibility to yield execution to a different fiber.
This was a sloppy implementation though and has been replaced since then in #6953

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants