M
M
Maxim Vlasov2021-03-06 23:03:03
go
Maxim Vlasov, 2021-03-06 23:03:03

How to process data in goroutines in batches?

Hello! I have never written parallel computing before. Faced with the task: there is a huge array of links. Let's say 10k pieces. They need to be processed in batches, at least 10 each. In fact, this is a parser. I read a lot about goroutines, but did not quite understand how to make them process such a large array in portions. Thanks in advance for your replies.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav, 2021-03-06
@tr0yka

There is a Worker Pool pattern, you can see an example here: https://gobyexample.com/worker-pools

T
t38c3j, 2021-03-07
@t38c3j

10k is not much, you can consider a simple package for this https://github.com/alitto/pond

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question