Пример #1
0
Файл: serf.go Проект: rjw1/serf
// checkQueueDepth periodically checks the size of a queue to see if
// it is too large
func (s *Serf) checkQueueDepth(limit int, name string, queue *memberlist.TransmitLimitedQueue, shutdownCh chan struct{}) {
	for {
		select {
		case <-time.After(time.Second):
			numq := queue.NumQueued()
			if numq >= limit {
				s.logger.Printf("[WARN] %s queue depth: %d", name, numq)
			}
		case <-shutdownCh:
			return
		}
	}
}
Пример #2
0
// checkQueueDepth periodically checks the size of a queue to see if
// it is too large
func (s *Serf) checkQueueDepth(name string, queue *memberlist.TransmitLimitedQueue) {
	for {
		select {
		case <-time.After(time.Second):
			numq := queue.NumQueued()
			if numq >= s.config.QueueDepthWarning {
				s.logger.Printf("[WARN] %s queue depth: %d", name, numq)
			}
			if numq > s.config.MaxQueueDepth {
				s.logger.Printf("[WARN] %s queue depth (%d) exceeds limit (%d), dropping messages!",
					name, numq, s.config.MaxQueueDepth)
				queue.Prune(s.config.MaxQueueDepth)
			}
		case <-s.shutdownCh:
			return
		}
	}
}