mirror of
https://git.robbyzambito.me/bluesky-nats-proxy/
synced 2025-12-21 00:34:50 +00:00
Handle exit gracefully
doesn't really work??
This commit is contained in:
10
main.go
10
main.go
@@ -6,6 +6,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -72,6 +74,10 @@ func main() {
|
|||||||
log.Fatalf("Error reading from Jetstream: %v", err)
|
log.Fatalf("Error reading from Jetstream: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep the program running
|
// Wait for interrupt signal to gracefully shut down
|
||||||
select {}
|
interrupt := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(interrupt, os.Interrupt)
|
||||||
|
<-interrupt
|
||||||
|
|
||||||
|
log.Println("Shutting down...")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user