// bufferLengthWithin returns nil if the given buffer reached a given buffer
// length within a given time frame. Otherwise returns error. This is a blocking
// call
bufferLengthWithin returns nil if the given buffer reached a given buffer
length within a given time frame. Otherwise returns error. This is a blocking
call
// bufferLengthWithin returns nil if the given buffer reached a given buffer // length within a given time frame . Otherwise returns error . This is a blocking // call
func bufferLengthWithin(a *AlgorandBuffer, l int, t time.Duration) error {
	now := time.Now()
	for time.Now().Sub(now) < t {
		time.Sleep(time.Millisecond * 50)
		ctx, cancel := context.WithTimeout(context.Background(), t-time.Now().Sub(now))
		data, err := a.GetBuffer(ctx)
		cancel()
		if err != nil {
			return err
		}
		if len(data) == l {
			return nil
		}
	}
	return fmt.Errorf("time limit exceeded. buffer length expected %d", l)
}
func bufferLengthWithin ( a * AlgorandBuffer , l int , t time . Duration ) error { now := time . Now ( ) for time . Now ( ) . Sub ( now ) < t { time . Sleep ( time . Millisecond * 50 ) ctx , cancel := context . WithTimeout ( context . Background ( ) , t - time . Now ( ) . Sub ( now ) ) data , err := a . GetBuffer ( ctx ) cancel ( ) if err != nil { return err } if len ( data ) == l { return nil } } return fmt . Errorf ( " " , l ) }
bufferLengthWithin returns nil if the given buffer reached a given buffer
length within a given time frame.
bufferLengthWithin returns nil if the given buffer reached a given buffer length within a given time frame .