Documentation
¶
Overview ¶
Package buildsignal implements the build poll loop. Each message carries a Build; the controller calls BuildRunner.Status, writes the latest status to the BuildStore, publishes the batch ID to TopicKeySpeculate so the state machine re-evaluates, and re-publishes itself via PublishAfter when the build has not yet reached a terminal state. Each buildID partitions independently, so slow polls on one build do not block others. A webhook-capable backend can publish into this same topic — the controller cannot tell a poll-driven message from a push.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // PollDelayAcceptedMs is the delay between Status calls while the build // is queued by the runner but has not started executing. PollDelayAcceptedMs int64 = 5000 // PollDelayRunningMs is the delay between Status calls while the build // is executing. PollDelayRunningMs int64 = 2000 )
Poll delays for non-terminal statuses. Vars (not consts) so tests can shorten them; the orchestrator always uses the defaults.
TODO: make these poll delays configurable per queue via the queueconfig extension instead of package-level vars, so operators can tune poll cadence without a code change.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller consumes build signal messages, polls BuildRunner.Status, persists the result, and drives the polling loop.
func NewController ¶
func NewController( logger *zap.SugaredLogger, scope tally.Scope, store storage.Storage, buildRunners buildrunner.Factory, registry consumer.TopicRegistry, topicKey consumer.TopicKey, consumerGroup string, ) *Controller
NewController creates a new build signal controller for the orchestrator.
func (*Controller) ConsumerGroup ¶
func (c *Controller) ConsumerGroup() string
ConsumerGroup returns the consumer group for offset tracking.
func (*Controller) Name ¶
func (c *Controller) Name() string
Name returns the controller name for logging and metrics.
func (*Controller) Process ¶
Process polls the build's current status, persists it, publishes the batch ID to speculate so the state machine re-evaluates, and re-publishes a delayed message back to this topic when the build is still in flight. Returns nil to ack (success), or error to nack/reject.
Error classification: deserialize, Status, UpdateStatus, and the speculate publish stay non-retryable — they reject straight to DLQ on the first failure, where the operational republish path is the recovery mechanism. Only the PublishAfter self-reschedule is retryable: it is the poll loop's heartbeat and runs only after status/persist/speculate have all succeeded, so a transient enqueue blip nacks and replays (up to MaxAttempts) rather than silently stalling the build, then still falls through to DLQ if it persists.
func (*Controller) TopicKey ¶
func (c *Controller) TopicKey() consumer.TopicKey
TopicKey returns the topic key this controller subscribes to.