Add quota receipt aggregation and approved standup advisories
This commit is contained in:
@@ -17,8 +17,9 @@ type AlwaysAvailable struct{}
|
||||
|
||||
func (AlwaysAvailable) Available(registry.Herdr) bool { return true }
|
||||
|
||||
// QuotaAvailability applies the conservative 80% rule to the most recent
|
||||
// native quota report in the configured rolling window.
|
||||
// QuotaAvailability applies the conservative 80% rule to summed native
|
||||
// receipts in the configured rolling window. Receipts are additive across
|
||||
// rotations; a cumulative report must not replace earlier rotations.
|
||||
type QuotaAvailability struct {
|
||||
Store *store.Store
|
||||
Limits map[string]float64
|
||||
@@ -51,8 +52,8 @@ func (q QuotaAvailability) Available(h registry.Herdr) bool {
|
||||
HarnessID string `json:"harness_id"`
|
||||
Consumed float64 `json:"consumed"`
|
||||
}
|
||||
if json.Unmarshal(e.Payload, &p) == nil && p.HarnessID == h.ID && p.Consumed > consumed {
|
||||
consumed = p.Consumed
|
||||
if json.Unmarshal(e.Payload, &p) == nil && p.HarnessID == h.ID && p.Consumed >= 0 {
|
||||
consumed += p.Consumed
|
||||
}
|
||||
}
|
||||
return consumed < limit*0.8
|
||||
|
||||
Reference in New Issue
Block a user