From e73de7985e1613935a36c6f750112c244a3299aa Mon Sep 17 00:00:00 2001 From: Andrey Petrov Date: Sat, 17 May 2014 16:24:12 -0700 Subject: [PATCH] STyle. --- crawler.go | 2 +- queue/queue.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crawler.go b/crawler.go index 1577818..91a3720 100644 --- a/crawler.go +++ b/crawler.go @@ -183,7 +183,7 @@ func (c *Crawler) Run(resultChan chan<- Result, numWorkers int) { numActive++ go func() { address := <-c.queue.Output - logger.Debugf("[%s] Worker started.", address) + logger.Debugf("[%s] Work received.", address) tempResult <- *c.handleAddress(address) }() diff --git a/queue/queue.go b/queue/queue.go index 001571c..c995f57 100644 --- a/queue/queue.go +++ b/queue/queue.go @@ -18,13 +18,13 @@ func NewQueue(filter func(string) *string, bufferSize int) *Queue { filter: filter, } - go func(input <-chan string, output chan<- string) { + go func() { // Block until we have a next item nextItem := q.next() for { select { - case item := <-input: + case item := <-q.Input: // New input r := q.filter(item) if r != nil { @@ -32,12 +32,12 @@ func NewQueue(filter func(string) *string, bufferSize int) *Queue { q.overflow = append(q.overflow, *r) q.count++ } - case output <- nextItem: + case q.Output <- nextItem: // Block until we have more inputs nextItem = q.next() } } - }(q.Input, q.Output) + }() return &q } @@ -64,7 +64,7 @@ func (q *Queue) next() string { } func (q *Queue) IsEmpty() bool { - // FIXME: This effectively cycles the order of the output buffer. Kinda sad. + // FIXME: This breaks everything, get rid of it. if len(q.overflow) > 0 { return false