func (q *pubQueue) Add(i preparedPub) bool {
	q.mu.Lock()
	if q.closed {
		q.mu.Unlock()
		return false
	}
	if q.cnt == len(q.nodes) {
		// Also tested a grow rate of 1.5, see: http://stackoverflow.com/questions/2269063/buffer-growth-strategy
		// In Go this resulted in a higher memory usage.
		q.resize(q.cnt * 2)
	}
	q.nodes[q.tail] = i
	q.tail = (q.tail + 1) % len(q.nodes)
	q.size += len(i.reply.Data())
	q.cnt++
	q.cond.Signal()
	q.mu.Unlock()
	return true
}
// Add a preparedPub to the back of the queue
// will return false if the queue is closed.
// In that case the preparedPub is dropped.
Add a preparedPub to the back of the queue
will return false if the queue is closed.
In that case the preparedPub is dropped.
// Add a preparedPub to the back of the queue // will return false if the queue is closed . // In that case the preparedPub is dropped .
func (q *pubQueue) Add(i preparedPub) bool {
	q.mu.Lock()
	if q.closed {
		q.mu.Unlock()
		return false
	}
	if q.cnt == len(q.nodes) {
		q.resize(q.cnt * 2)
	}
	q.nodes[q.tail] = i
	q.tail = (q.tail + 1) % len(q.nodes)
	q.size += len(i.reply.Data())
	q.cnt++
	q.cond.Signal()
	q.mu.Unlock()
	return true
}
func ( q * pubQueue ) Add ( i preparedPub ) bool { q . mu . Lock ( ) if q . closed { q . mu . Unlock ( ) return false } if q . cnt == len ( q . nodes ) { q . resize ( q . cnt * 2 ) } q . nodes [ q . tail ] = i q . tail = ( q . tail + 1 ) % len ( q . nodes ) q . size += len ( i . reply . Data ( ) ) q . cnt ++ q . cond . Signal ( ) q . mu . Unlock ( ) return true }
Add a preparedPub to the back of the queue
will return false if the queue is closed.
Add a preparedPub to the back of the queue will return false if the queue is closed .
// Also tested a grow rate of 1.5, see: http://stackoverflow.com/questions/2269063/buffer-growth-strategy // In Go this resulted in a higher memory usage.