monochromegane / kaburaya

Kaburaya optimize the number of goroutines by feedback control.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Kaburaya optimize the number of goroutines by feedback control.

License:MIT License


Languages

Language:Go 100.0%