MCPcopy Create free account
hub / github.com/coder/coder / recalculateReadinessUnsafe

Method recalculateReadinessUnsafe

agent/unit/manager.go:217–233  ·  view source on GitHub ↗

recalculateReadinessUnsafe recalculates the readiness state for a unit. This method assumes the caller holds the write lock.

(unit ID)

Source from the content-addressed store, hash-verified

215// recalculateReadinessUnsafe recalculates the readiness state for a unit.
216// This method assumes the caller holds the write lock.
217func (m *Manager) recalculateReadinessUnsafe(unit ID) {
218 u := m.units[unit]
219 dependencies := m.graph.GetForwardAdjacentVertices(unit)
220
221 allSatisfied := true
222 for _, dependency := range dependencies {
223 requiredStatus := dependency.Edge
224 dependsOnUnit := m.units[dependency.To]
225 if dependsOnUnit.status != requiredStatus {
226 allSatisfied = false
227 break
228 }
229 }
230
231 u.ready = allSatisfied
232 m.units[unit] = u
233}
234
235// GetGraph returns the underlying graph for visualization and debugging.
236// This should be used carefully as it exposes the internal graph structure.

Callers 2

AddDependencyMethod · 0.95
UpdateStatusMethod · 0.95

Calls 1

Tested by

no test coverage detected