Fix shutdown sequence to ensure final snapshot is taken

- Add Shutdown() method to RouteWatch with mutex-protected shutdown flag
- Move all cleanup logic from Run() to Shutdown()
- Call Shutdown() from fx OnStop hook
- This ensures snapshotter gets called during graceful shutdown
This commit is contained in:
2025-07-28 00:11:54 +02:00
parent 52cdcd5785
commit fa9b086629
2 changed files with 21 additions and 3 deletions
+1
View File
@@ -40,6 +40,7 @@ func CLIEntry() {
},
OnStop: func(_ context.Context) error {
logger.Info("Shutting down RouteWatch")
rw.Shutdown()
return nil
},