// NewMemQueue returns a new wait queue that holds at most max items. func NewMemQueue(max int) queue.WaitQueue { q := &MemQueue{ max: max, } q.popCond = sync.NewCond(&q.mu) q.pushCond = sync.NewCond(&q.mu) return queue.WithChannel(q) }
// NewWaitQueue creates a rate limit wait queue. func NewWaitQueue(opt *Option) queue.WaitQueue { return queue.WithChannel(New(opt)) }