/qu

Qu is a go executor service

Primary LanguageGoMIT LicenseMIT

QU

Go Report Card Godoc Releases LICENSE

Package qu is a simple executor service. You add jobs to a queue, then run them concurrently with a configurable amount of concurrency.

Usage

queue := &qu.Queue{}

job := func(payload interface{}) {
	i := payload.(int)
	fmt.Printf("Job %d\n", i)
	time.Sleep(1 * time.Millisecond)
}

// Add 50 jobs to the queue
i := 0
for i < 50 {
	queue.Add(job, i)
	i++
}

// Go through those 50 jobs across 2 threads
queue.Run(2)