Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry tracks active workers that are polling for tasks. It is safe for concurrent use.
func (*Registry) ListWorkers ¶
func (r *Registry) ListWorkers(staleness time.Duration) []WorkerInfo
ListWorkers returns info about all workers that have polled recently. Workers that haven't polled in the given staleness duration are pruned.
func (*Registry) RecordPollEnd ¶
RecordPollEnd is called when a worker's long-poll request completes.
func (*Registry) RecordPollStart ¶
RecordPollStart is called when a worker begins a long-poll request.
type WorkerInfo ¶
type WorkerInfo struct {
// WorkerID is a unique identifier for this worker instance.
WorkerID string `json:"worker_id"`
// MaxConcurrentTasks is the maximum number of tasks this worker can run simultaneously.
MaxConcurrentTasks int `json:"max_concurrent_tasks"`
// ActiveTasks is the number of tasks currently being executed by this worker.
ActiveTasks int `json:"active_tasks"`
// ConnectedAt is when this worker first connected.
ConnectedAt time.Time `json:"connected_at"`
// LastPollAt is when this worker last polled for work.
LastPollAt time.Time `json:"last_poll_at"`
// UptimeMs is total uptime since the worker first connected.
UptimeMs int64 `json:"uptime_ms"`
// Polling indicates whether the worker is currently in a long-poll request.
Polling bool `json:"polling"`
}
WorkerInfo represents a connected worker and its metadata.
Click to show internal directories.
Click to hide internal directories.