
Sign up to save your podcasts
Or


Go's worker queue pattern:
type WorderPool struct {
  queue chan int
}
func (wp *WorkerPool) start() {
  for i := 0; i < 500; i++ {
    go funcIO {
      for id := range wp.queue {
        doSomething(id)
      }
    }()
  }
}
func (wp *WorkerPool) add(id int) {
  wp.queue <- id
}
Best way to show support for the pod is by sharing it around and buying my course.
By Dominic St-Pierre3.8
66 ratings
Go's worker queue pattern:
type WorderPool struct {
  queue chan int
}
func (wp *WorkerPool) start() {
  for i := 0; i < 500; i++ {
    go funcIO {
      for id := range wp.queue {
        doSomething(id)
      }
    }()
  }
}
func (wp *WorkerPool) add(id int) {
  wp.queue <- id
}
Best way to show support for the pod is by sharing it around and buying my course.

273 Listeners

379 Listeners

290 Listeners

625 Listeners

153 Listeners

588 Listeners

283 Listeners

985 Listeners

188 Listeners

181 Listeners

62 Listeners

141 Listeners

59 Listeners

16 Listeners

64 Listeners