/kaburaya

Kaburaya optimize the number of goroutines by feedback control.

Primary LanguageGoMIT LicenseMIT

Kaburaya Build Status

WIP.

Kaburaya optimize the number of goroutines by feedback control. It provides elastic semaphore.

Usage

sem := kaburaya.NewSem(100*time.Millisecond, 0.1)
var wg sync.WaitGroup
for // Something condition {
	wg.Add(1)
	sem.Wait()
	go func() {
		defer sem.Signal()
		defer wg.Done()
		// Something job
	}()
}
wg.Wait()
sem.Stop()

License

MIT

Author

monochromegane