ShutdownWithTimeout gracefully shuts down the server without interrupting any active connections. However, if the timeout is exceeded, ShutdownWithTimeout will forcefully close any active connections. ShutdownWithTimeout works by first closing all open listeners and then waiting for all connections
(timeout time.Duration)
| 1283 | // |
| 1284 | // ShutdownWithTimeout does not close keepalive connections so its recommended to set ReadTimeout to something else than 0. |
| 1285 | func (app *App) ShutdownWithTimeout(timeout time.Duration) error { |
| 1286 | ctx, cancelFunc := context.WithTimeout(context.Background(), timeout) |
| 1287 | defer cancelFunc() |
| 1288 | return app.ShutdownWithContext(ctx) |
| 1289 | } |
| 1290 | |
| 1291 | // ShutdownWithContext shuts down the server including by force if the context's deadline is exceeded. |
| 1292 | // |