func()

in pkg/controller/manager.go [244:275]


func (am *actionManager) handle(node intent.Input) {
	log := am.log.WithField("node", node.GetName())
	log.Debug("handling event")

	in := am.intentFor(node)
	if in == nil {
		return // no actionable intent signaled
	}
	log = log.WithFields(logfields.Intent(in))

	lastQueued := am.lastCache.Last(in)
	if logging.Debuggable && lastQueued != nil {
		log.WithField("last-intent", lastQueued.DisplayString()).
			Debug("retrieved cached queued intent to dedupe")
	}
	if intent.Equivalent(lastQueued, in) {
		log.Debug("not queuing duplicate intent")
		return
	}

	record := in.Clone()
	select {
	case am.inputs <- in:
		log.Debug("queue intent")
		am.lastCache.Record(record)
	default:
		log.WithFields(logrus.Fields{
			"queue":        "input",
			"queue-length": len(am.inputs),
		}).Warn("unable to queue intent (back pressure)")
	}
}