func waitForConfigs(checkName string, retryInterval, timeout time.Duration) []integration.Config {
	allConfigs := common.AC.GetAllConfigs()
	if containsCheck(checkName, allConfigs) {
		return allConfigs
	}

	ctx, cancel := context.WithTimeout(context.Background(), timeout)
	defer cancel()

	retryTicker := time.NewTicker(retryInterval)
	defer retryTicker.Stop()

	for {
		select {
		case <-ctx.Done():
			return allConfigs
		case <-retryTicker.C:
			allConfigs = common.AC.GetAllConfigs()
			if containsCheck(checkName, allConfigs) {
				return allConfigs
			}
		}
	}
}
// waitForConfigs retries the collection of Autodiscovery configs until the check is found or the timeout is reached.
// Autodiscovery listeners run asynchronously, AC.GetAllConfigs() can fail at the beginning to resolve templated configs
// depending on non-deterministic factors (system load, network latency, active Autodiscovery listeners and their configurations).
// This function improves the resiliency of the check command.
// Note: If the check corresponds to a non-template configuration it should be found on the first try and fast-returned.
waitForConfigs retries the collection of Autodiscovery configs until the check is found or the timeout is reached.
Autodiscovery listeners run asynchronously, AC.GetAllConfigs() can fail at the beginning to resolve templated configs
depending on non-deterministic factors (system load, network latency, active Autodiscovery listeners and their configurations).
This function improves the resiliency of the check command.
Note: If the check corresponds to a non-template configuration it should be found on the first try and fast-returned.
// waitForConfigs retries the collection of Autodiscovery configs until the check is found or the timeout is reached . // Autodiscovery listeners run asynchronously AC . GetAllConfigs () can fail at the beginning to resolve templated configs // depending on non - deterministic factors ( system load network latency active Autodiscovery listeners and their configurations ) . // This function improves the resiliency of the check command . // Note : If the check corresponds to a non - template configuration it should be found on the first try and fast - returned .
func waitForConfigs(checkName string, retryInterval, timeout time.Duration) []integration.Config {
	allConfigs := common.AC.GetAllConfigs()
	if containsCheck(checkName, allConfigs) {
		return allConfigs
	}
	ctx, cancel := context.WithTimeout(context.Background(), timeout)
	defer cancel()
	retryTicker := time.NewTicker(retryInterval)
	defer retryTicker.Stop()
	for {
		select {
		case <-ctx.Done():
			return allConfigs
		case <-retryTicker.C:
			allConfigs = common.AC.GetAllConfigs()
			if containsCheck(checkName, allConfigs) {
				return allConfigs
			}
		}
	}
}
func waitForConfigs ( checkName string , retryInterval , timeout time . Duration ) [ ] integration . Config { allConfigs := common . AC . GetAllConfigs ( ) if containsCheck ( checkName , allConfigs ) { return allConfigs } ctx , cancel := context . WithTimeout ( context . Background ( ) , timeout ) defer cancel ( ) retryTicker := time . NewTicker ( retryInterval ) defer retryTicker . Stop ( ) for { select { case <- ctx . Done ( ) : return allConfigs case <- retryTicker . C : allConfigs = common . AC . GetAllConfigs ( ) if containsCheck ( checkName , allConfigs ) { return allConfigs } } } }
waitForConfigs retries the collection of Autodiscovery configs until the check is found or the timeout is reached.
waitForConfigs retries the collection of Autodiscovery configs until the check is found or the timeout is reached .