mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
On daemon shutdown, the HTTP server tries to gracefully shutdown for 5 seconds. If there's an open API connection to the '/events' endpoint, it fails to do so as nothing interrupts that connection, thus forcing the daemon to wait until that timeout is reached. Add a Close method to the EventsService, and call it during daemon shutdown. It'll close any events channel, signaling to the '/events' handler to return and close the connection. It now takes ~1s (or less) to shutdown the daemon when there's an active '/events' connection, instead of 5. Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>