github.com/Jeffail/benthos/v3@v3.65.0/internal/component/output/max_in_flight.go (about)

     1  package output
     2  
     3  // GetMaxInFlight attempts to derive a max in flight value from the provided
     4  // output, and returns the count and a boolean flag indicating whether the
     5  // output provided that value. This value can be used to determine a sensible
     6  // value for parent outputs, but should not be relied upon as part of dispatcher
     7  // logic.
     8  func GetMaxInFlight(o interface{}) (int, bool) {
     9  	if mf, ok := o.(interface {
    10  		MaxInFlight() (int, bool)
    11  	}); ok {
    12  		return mf.MaxInFlight()
    13  	}
    14  	return 0, false
    15  }