manageGracefulTimeout allows the gracefulContext to last longer than the main context to allow a graceful disconnect.
()
| 1516 | // manageGracefulTimeout allows the gracefulContext to last longer than the main context |
| 1517 | // to allow a graceful disconnect. |
| 1518 | func (c *Controller) manageGracefulTimeout() { |
| 1519 | defer c.cancelGracefulCtx() |
| 1520 | <-c.ctx.Done() |
| 1521 | timer := c.clock.NewTimer(c.gracefulTimeout, "tailnetAPIClient", "gracefulTimeout") |
| 1522 | defer timer.Stop() |
| 1523 | select { |
| 1524 | case <-c.closedCh: |
| 1525 | case <-timer.C: |
| 1526 | } |
| 1527 | } |
| 1528 | |
| 1529 | // Run dials the API and uses it with the provided controllers. |
| 1530 | func (c *Controller) Run(ctx context.Context) { |