add shutdown context unit test

This commit is contained in:
iofq
2024-11-09 15:34:35 -06:00
parent 8436001d5b
commit 840b76228a
2 changed files with 11 additions and 0 deletions

View File

@@ -65,6 +65,7 @@ func aptlyAPIServe(cmd *commander.Command, args []string) error {
signal.Notify(sigchan, syscall.SIGINT, syscall.SIGTERM)
go (func() {
if _, ok := <-sigchan; ok {
fmt.Printf("\nShutdown signal received, waiting for background tasks...\n")
context.TaskList().Wait()
server.Shutdown(stdcontext.Background())
}