Serve can (re)run the server with the latest known configuration.
()
| 110 | |
| 111 | // Serve can (re)run the server with the latest known configuration. |
| 112 | func (h TaskHost) Serve() error { |
| 113 | // the underline server's serve, using the "latest known" listener from the supervisor. |
| 114 | l, err := h.Supervisor.newListener() |
| 115 | if err != nil { |
| 116 | return err |
| 117 | } |
| 118 | |
| 119 | // if http.serverclosed ignore the error, it will have this error |
| 120 | // from the previous close |
| 121 | if err := h.Supervisor.Server.Serve(l); !errors.Is(err, http.ErrServerClosed) { |
| 122 | return err |
| 123 | } |
| 124 | return nil |
| 125 | } |
| 126 | |
| 127 | // HostURL returns the listening full url (scheme+host) |
| 128 | // based on the supervisor's server's address. |