internal/aggregate: make shutdown context-aware proper goroutine sync
Adds `WaitGroup` to track background goroutine and make Shutdown respect context deadlines Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ia7f074725717f037412dacb93e34105b6a6a6964
This commit is contained in:
parent
de959ec22b
commit
987ddd92cc
4 changed files with 205 additions and 9 deletions
|
|
@ -31,9 +31,14 @@ func Run(cfg *config.Config) error {
|
|||
eventRegistry := aggregate.NewCustomEventRegistry(cfg.Limits.MaxCustomEvents)
|
||||
metricsAgg := aggregate.NewMetricsAggregator(pathRegistry, eventRegistry, cfg)
|
||||
|
||||
// HLL state persistence is handled automatically if salt_rotation is configured
|
||||
// Load HLL state from previous run if it exists
|
||||
if cfg.Site.SaltRotation != "" {
|
||||
log.Println("HLL state persistence enabled")
|
||||
if err := metricsAgg.LoadState(); err != nil {
|
||||
log.Printf("Could not load HLL state (might be first run): %v", err)
|
||||
} else {
|
||||
log.Println("HLL state restored from previous run")
|
||||
}
|
||||
}
|
||||
|
||||
// Register Prometheus metrics
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue