News for hackers. Stuff that matters.
Re:The Simplicity of Single-File Golang Deployments by joncfoo on Wednesday March 22, 2023 @10:45AM (#35261831)
Rough psuedocode to do this with the built-in http.Server where startServer(..) would use the reuseport library to create the listener so multiple servers can listen within the same process:

  func reloadConfig(config) {
    if newServer, err := startServer(config); err != nil {
      // gracefully shutdown previous server
      // no new connections will go to old server
      oldServer.Shutdown(...)
      oldServer = newServer
    }
  }

There are no comments on this comment yet.