Skip to content

Instantly share code, notes, and snippets.

View chilic's full-sized avatar

Chilic chilic

View GitHub Profile
@chilic
chilic / golang_job_queue.md
Created August 5, 2018 19:51 — forked from harlow/golang_job_queue.md
Job queues in Golang
package main
const MaxLength = 1 << 20
var (
addr = flag.String("listen", ":8000", "listen for requests")
numprocs = flag.Int("p", runtime.NumCPU(), "number of workers to start")
maxqueue = flag.Int("q", runtime.NumCPU()*2, "largest queue size")
jobs chan Job