throttle.go
func (t *throttle) Wait(
	ctx context.Context,
	tokens uint64) (err error) {
	now := MonotonicTime(time.Now().Sub(t.startTime))

	t.mu.Lock()
	sleepUntil := t.bucket.Remove(now, tokens)
	t.mu.Unlock()

	select {
	case <-ctx.Done():
		err = ctx.Err()
		return

	case <-time.After(time.Duration(sleepUntil - now)):
		return
	}
}
func (t *throttle) Wait(
	ctx context.Context,
	tokens uint64) (err error) {
	now := MonotonicTime(time.Now().Sub(t.startTime))

	t.mu.Lock()
	sleepUntil := t.bucket.Remove(now, tokens)
	t.mu.Unlock()

	select {
	case <-ctx.Done():
		err = ctx.Err()
		return

	case <-time.After(time.Duration(sleepUntil - now)):
		return
	}
}
// LOCKS_EXCLUDED(t.mu)