My first post in the forum
I’ve a question I could not find a proper response anywhere.
I know how to build a pool of workers using go routine without problem. My question is related to a shared pool of workers.
Let’s suppose I’ve a webserver where request are coming every time from different users. My idea is to build a shared pool of workers, it means, a pool shared by all the web sessions.
Creating the pool is no problem, I’m just trying to figure out the best way to collect the results back. I mean, making all the workers writing the results in a same channel will be a mess, since I’ll have results from different sessions in a same channel. Should I provide a “private” channel for each session, so the worker will write on this channel?
Also, how’s the wait condition done in a shared pool? All the examples so far consider a single jobs channel, that are closed when no more jobs are necessary. But what about a shared pool? Let’s say I’ve put two jobs in the worker’s channel. How to make the session wait for all the workers to finish processing these requests?
Thanks in advance for any support and sorry for so many questions!