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

Method countInProgress

coderd/prebuilds/preset_snapshot.go:454–468  ·  view source on GitHub ↗

countInProgress returns counts of prebuilds in transition states (starting, stopping, deleting). These counts are tracked at the template level, so all presets sharing the same template see the same values.

()

Source from the content-addressed store, hash-verified

452// countInProgress returns counts of prebuilds in transition states (starting, stopping, deleting).
453// These counts are tracked at the template level, so all presets sharing the same template see the same values.
454func (p PresetSnapshot) countInProgress() (starting int32, stopping int32, deleting int32) {
455 for _, progress := range p.InProgress {
456 num := progress.Count
457 switch progress.Transition {
458 case database.WorkspaceTransitionStart:
459 starting += num
460 case database.WorkspaceTransitionStop:
461 stopping += num
462 case database.WorkspaceTransitionDelete:
463 deleting += num
464 }
465 }
466
467 return starting, stopping, deleting
468}
469
470// getOldestPrebuildIDs returns the IDs of the N oldest prebuilds, sorted by creation time.
471// This is used when we need to delete prebuilds, ensuring we remove the oldest ones first.

Callers 1

CalculateStateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected