func OutOfLockstep()

in internal/inputs/inputs.go [24:53]


func OutOfLockstep(synth *apiv1.Synthesizer, revs []apiv1.InputRevisions) bool {
	// First, the the max revision across all bindings
	var maxRevision *int
	for _, rev := range revs {
		if rev.SynthesizerGeneration != nil && *rev.SynthesizerGeneration < synth.Generation {
			return true
		}
		if rev.Revision == nil {
			continue
		}
		if maxRevision == nil {
			maxRevision = rev.Revision
			continue
		}
		if *rev.Revision > *maxRevision {
			maxRevision = rev.Revision
		}
	}
	if maxRevision == nil {
		return false // no inputs declare a revision, so we should assume they're in sync
	}

	// Now given the max, make sure all inputs with a revision match it
	for _, rev := range revs {
		if rev.Revision != nil && *maxRevision != *rev.Revision {
			return true
		}
	}
	return false
}