Skip to content

Instantly share code, notes, and snippets.

@jackypanster
Last active December 13, 2016 07:30
Show Gist options
  • Save jackypanster/e25e9d911705da19780ddcd82d4736a6 to your computer and use it in GitHub Desktop.
Save jackypanster/e25e9d911705da19780ddcd82d4736a6 to your computer and use it in GitHub Desktop.
thread pool pattern
dispatcher := NewDispatcher(MaxWorker)
dispatcher.Run()
var (
MaxWorker = os.Getenv("MAX_WORKERS")
MaxQueue = os.Getenv("MAX_QUEUE")
)
// let's create a job with the payload
work := Job{Payload: payload}
// Push the work onto the queue.
JobQueue <- work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment