feat(jobs): add durable PG queue reclaim, slog, and richer metrics
JSON slog в ключевых пакетах; Prometheus path_group, job_audit_depth, upstream breaker; job_audit ClaimQueued/ReclaimStaleRunning + Adopt loop для HA после рестарта. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -49,6 +49,24 @@ func (b *hostBreaker) recordFailure() {
|
||||
}
|
||||
}
|
||||
|
||||
// SnapshotBreakers returns whether each known host breaker is currently open.
|
||||
func SnapshotBreakers() map[string]bool {
|
||||
out := map[string]bool{}
|
||||
hostBreakers.Range(func(key, value any) bool {
|
||||
host, _ := key.(string)
|
||||
b, _ := value.(*hostBreaker)
|
||||
if b == nil {
|
||||
return true
|
||||
}
|
||||
b.mu.Lock()
|
||||
open := time.Now().Before(b.openUntil)
|
||||
b.mu.Unlock()
|
||||
out[host] = open
|
||||
return true
|
||||
})
|
||||
return out
|
||||
}
|
||||
|
||||
// ResetHostBreakers clears all circuit breakers (tests only).
|
||||
func ResetHostBreakers() {
|
||||
hostBreakers = sync.Map{}
|
||||
|
||||
Reference in New Issue
Block a user