Last active
December 13, 2016 07:30
-
-
Save jackypanster/e25e9d911705da19780ddcd82d4736a6 to your computer and use it in GitHub Desktop.
thread pool pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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