ArgCV

  • Home
  • Code
    • Snippets
  • Life
  • About
  • Gallery
  • Guestbook
  • RSS

context

Code

Gracefully shutdown a http server in golang

To gracefully shutdown a http server requires a few steps.

The http library's serving function will block over there when getting started, until we call http.Server.Close(). As for us, we can invoke the starting function in a goroutine, and call close in another one.

(more…)

By Yu, 6 years2 years ago
  • Home
  • About
  • Guestbook
  • Privacy Policy
Hesmod | Developed by ThemeIsle, Revised by ArgCV