summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/executor/executor.go2
-rw-r--r--internal/storage/db.go12
2 files changed, 8 insertions, 6 deletions
diff --git a/internal/executor/executor.go b/internal/executor/executor.go
index 9052bd7..b8979a1 100644
--- a/internal/executor/executor.go
+++ b/internal/executor/executor.go
@@ -626,6 +626,7 @@ type AgentStatusInfo struct {
ActiveTasks int `json:"active_tasks"`
RateLimited bool `json:"rate_limited"`
Until *time.Time `json:"until,omitempty"`
+ Drained bool `json:"drained"`
}
// AgentStatuses returns the current status of all registered agents.
@@ -638,6 +639,7 @@ func (p *Pool) AgentStatuses() []AgentStatusInfo {
info := AgentStatusInfo{
Agent: agent,
ActiveTasks: p.activePerAgent[agent],
+ Drained: p.drained[agent],
}
if deadline, ok := p.rateLimited[agent]; ok && now.Before(deadline) {
info.RateLimited = true
diff --git a/internal/storage/db.go b/internal/storage/db.go
index 24a6cd3..ee5ee77 100644
--- a/internal/storage/db.go
+++ b/internal/storage/db.go
@@ -1031,12 +1031,12 @@ func (s *DB) SetSetting(key, value string) error {
// AgentEvent records a rate-limit state change for an agent.
type AgentEvent struct {
- ID string
- Agent string
- Event string // "rate_limited" | "available"
- Timestamp time.Time
- Until *time.Time // non-nil for "rate_limited" events
- Reason string // "transient" | "quota"
+ ID string `json:"id"`
+ Agent string `json:"agent"`
+ Event string `json:"event"` // "rate_limited" | "available"
+ Timestamp time.Time `json:"timestamp"`
+ Until *time.Time `json:"until,omitempty"` // non-nil for "rate_limited" events
+ Reason string `json:"reason"` // "transient" | "quota"
}
// RecordAgentEvent inserts an agent rate-limit event.