Skip to content

Commit

Permalink
hq.consumer: send values instead of pointers in urlBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
equals215 committed Nov 29, 2024
1 parent 7c5089e commit 3d1879c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/pkg/source/hq/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func consumer() {
batchSize := config.Get().HQBatchSize

// Create a fixed-size buffer (channel) for URLs
urlBuffer := make(chan *gocrawlhq.URL, batchSize)
urlBuffer := make(chan gocrawlhq.URL, batchSize)

// WaitGroup to wait for goroutines to finish on shutdown
var wg sync.WaitGroup
Expand Down Expand Up @@ -65,7 +65,7 @@ func consumer() {
}
}

func consumerFetcher(ctx context.Context, wg *sync.WaitGroup, urlBuffer chan<- *gocrawlhq.URL, batchSize int) {
func consumerFetcher(ctx context.Context, wg *sync.WaitGroup, urlBuffer chan<- gocrawlhq.URL, batchSize int) {
defer wg.Done()

logger := log.NewFieldedLogger(&log.Fields{
Expand Down Expand Up @@ -99,13 +99,13 @@ func consumerFetcher(ctx context.Context, wg *sync.WaitGroup, urlBuffer chan<- *
case <-ctx.Done():
logger.Debug("closed")
return
case urlBuffer <- &URLs[i]:
case urlBuffer <- URLs[i]:
}
}
}
}

func consumerSender(ctx context.Context, wg *sync.WaitGroup, urlBuffer <-chan *gocrawlhq.URL) {
func consumerSender(ctx context.Context, wg *sync.WaitGroup, urlBuffer <-chan gocrawlhq.URL) {
defer wg.Done()

logger := log.NewFieldedLogger(&log.Fields{
Expand Down

0 comments on commit 3d1879c

Please sign in to comment.