Looking through Buildkite builds in progress, I see steps/jobs go through a process of:
Dispatcher Assigned Job to XYZ (+1s)
XYZ Accepted Job (+6s)
In the Buildkite Agent code, in agent/agent_worker.go:191 and agent/agent_worker.go:200, it looks like the agent is receiving notice of an available job, and then separately accepts the job with nothing happening in between.
My question is this: does the Buildkite dispatcher assign jobs to agents at the time of the agent’s Ping call, or does it pre-assign jobs to agents it knows are idle, and the agent learns about the pre-assigned job at the time of its Ping?
Great question. There is a ping interval that dictates how often the agents poll the agent API for work.
The frequency of the pings depends on the number of agents you have connected, but generally speaking, you could expect a ~5 second delay (which you have observed)