func checkWithTimeout(timeout time.Duration,
	tick time.Duration,
	f checkWithTimeoutType) (bool, error) {

	_timeout := time.After(timeout * time.Millisecond)
	_tick := time.Tick(tick * time.Millisecond)

	for {
		select {
		case <-_timeout:
			return false, errors.New("timed out")
		case <-_tick:
			ok, err := f()
			if err != nil {
				return false, err
			} else if ok {
				return true, nil
			}
		}
	}
}
// timeout and tick are measurd in milliseconds units
timeout and tick are measurd in milliseconds units
// timeout and tick are measurd in milliseconds units
func checkWithTimeout(timeout time.Duration,
	tick time.Duration,
	f checkWithTimeoutType) (bool, error) {
	_timeout := time.After(timeout * time.Millisecond)
	_tick := time.Tick(tick * time.Millisecond)
	for {
		select {
		case <-_timeout:
			return false, errors.New("timed out")
		case <-_tick:
			ok, err := f()
			if err != nil {
				return false, err
			} else if ok {
				return true, nil
			}
		}
	}
}
func checkWithTimeout ( timeout time . Duration , tick time . Duration , f checkWithTimeoutType ) ( bool , error ) { _timeout := time . After ( timeout * time . Millisecond ) _tick := time . Tick ( tick * time . Millisecond ) for { select { case <- _timeout : return false , errors . New ( " " ) case <- _tick : ok , err := f ( ) if err != nil { return false , err } else if ok { return true , nil } } } }
timeout and tick are measurd in milliseconds units
timeout and tick are measurd in milliseconds units