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:
@@ -40,6 +40,7 @@ func CLIEntry() {
|
||||
},
|
||||
OnStop: func(_ context.Context) error {
|
||||
logger.Info("Shutting down RouteWatch")
|
||||
rw.Shutdown()
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user