Handle exit gracefully

doesn't really work??
This commit is contained in:
2025-01-20 21:18:18 -05:00
parent 43c8c77898
commit 2f1a61fe40

10
main.go
View File

@@ -6,6 +6,8 @@ import (
"fmt"
"log"
"log/slog"
"os"
"os/signal"
"runtime"
"time"
@@ -72,6 +74,10 @@ func main() {
log.Fatalf("Error reading from Jetstream: %v", err)
}
// Keep the program running
select {}
// Wait for interrupt signal to gracefully shut down
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt)
<-interrupt
log.Println("Shutting down...")
}