I was wondering if there was any built-in way of storing data per worker (e.g. TCP connections) and retrieve them in a task.
Something like this:
// Create a pool with limited concurrency
pool := pond.NewPool(100)
// Submit 1000 tasks
for i := 0; i < 1000; i++ {
i := i
pool.Submit(func(wc pond.WorkerContext) {
t, ok := wc.Get("worker")
if !ok {
t = i
wc.Set("worker, i)
}
fmt.Printf("Running task #%d in worker #%d\n", i, t)
})
}
I don't know a lot about pond but I think such a feature would be quite cool
I was wondering if there was any built-in way of storing data per worker (e.g. TCP connections) and retrieve them in a task.
Something like this:
I don't know a lot about pond but I think such a feature would be quite cool