Drain the handler queues before stopping the handlers on shutdown (closes #69)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
Shutdown stopped the handlers before the streamer, so updates still in the handler queues, up to 20,000 per queue, were not written, and a lost withdrawal left its route in the table after a restart. Shutdown now stops the streamer first. Streamer.Stop queues the STATE messages it holds for a full queue, closes the queues and returns once every worker has handed its handler everything on its queue; then each handler writes what it holds before its Stop returns. PeeringHandler.Stop now waits for its loop's final write instead of running a second one beside it. Model: opus-5-5
This commit was merged in pull request #95.
This commit is contained in:
@@ -149,7 +149,10 @@ func (rw *RouteWatch) Shutdown(ctx context.Context) {
|
||||
rw.shutdown = true
|
||||
rw.mu.Unlock()
|
||||
|
||||
// Stop batched handlers first to flush remaining batches
|
||||
// Stop the streamer first: it returns once the handlers have been handed
|
||||
// every message it queued. Then each handler writes what it holds.
|
||||
rw.streamer.Stop()
|
||||
|
||||
if rw.dbHandler != nil {
|
||||
rw.logger.Info("Flushing database handler")
|
||||
rw.dbHandler.Stop()
|
||||
@@ -180,9 +183,6 @@ func (rw *RouteWatch) Shutdown(ctx context.Context) {
|
||||
rw.dbMaintainer.Stop()
|
||||
}
|
||||
|
||||
// Stop services
|
||||
rw.streamer.Stop()
|
||||
|
||||
// Stop HTTP server with a timeout of its own, however much of ctx is left
|
||||
const serverStopTimeout = 5 * time.Second
|
||||
|
||||
|
||||
Reference in New Issue
Block a user