fix(replication): handle absent pool in worker metrics

Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
Feng Ruohang
2026-11-09 18:10:19 +08:00
parent c054569b9f
commit 099b7ddf37
3 changed files with 38 additions and 1 deletions
+4 -1
View File
@@ -119,7 +119,10 @@ func (a *ActiveWorkerStat) update() {
if a == nil {
return
}
a.Curr = globalReplicationPool.Get().ActiveWorkers()
a.Curr = 0
if pool := globalReplicationPool.Get(); pool != nil {
a.Curr = pool.ActiveWorkers()
}
a.hist.Update(int64(a.Curr))
a.Avg = float32(a.hist.Mean())
a.Max = int(a.hist.Max())