-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restart a HTTP server on schema updates (#5)
Fixes #41 In a previous PR, the schema that was shared between the state machine and the HTTP server behind a lock was removed, so schema update was broken. We want to fix it without reintroducing a lock in the middle of the hot path for queries. Our solution here is to launch a new HTTP server with the new schema configuration on schema updates, as launching a server is very cheap. We need to replace warp's HTTP server with our own loop though, to get the ability to reuse the TCP listener socket from one server to the next and avoid losing TCP connections. ## graceful shutdown Since we do not have access to the private hyper structs and traits used to implement it (Graceful, Watch, Exec, ConnStreamExec...), it is challenging to make a struct wrapper for a Connection, especially if we want to satisfy the bounds of https://docs.rs/hyper/0.14.13/hyper/server/conn/struct.Connection.html#method.graceful_shutdown What we can do, though, is to select over the shutdown watcher and the connection: - if the connection finishes first, exit there - if the shutdown watcher exits first, call graceful_shutdown() on the connection then await on the connection Additional fixes: * make server handle member as private (this helps in isolating the TcpListener dance) * the graph fetcher must regenerate on config update (Example case: the new configuration sets up override addresses for backend services, so the HttpServiceRegistry used by the graph fetcher must be recreated)
- Loading branch information
Showing
6 changed files
with
264 additions
and
81 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.