Function
createSessionWithRegisteredCancel
(
srv *server.Server,
timeout time.Duration,
key server.BackendKey,
createFn func(context.Context) (int32, *flightclient.FlightExecutor, error),
)
Source from the content-addressed store, hash-verified
| 727 | |
| 728 | // Block until a successful upgrade causes tableflip to signal exit. |
| 729 | // SIGTERM/SIGINT are handled above and call os.Exit directly. |
| 730 | <-upg.Exit() |
| 731 | |
| 732 | // A successful upgrade completed — drain in-flight connections and exit. |
| 733 | cp.drainAfterUpgrade() |
| 734 | } |
| 735 | |
| 736 | func makeShutdownCtx() context.Context { |
| 737 | ctx, cancel := context.WithCancel(context.Background()) |
| 738 | sigCh := make(chan os.Signal, 1) |
| 739 | signal.Notify(sigCh, syscall.SIGTERM, syscall.SIGINT) |
| 740 | go func() { |
| 741 | <-sigCh |
| 742 | cancel() |
| 743 | }() |
| 744 | return ctx |
| 745 | } |