func Do(f func() error) error {
	// Limit the number of conurrent inserts in order to prevent from excess
	// memory usage and CPU trashing.
	t := time.NewTimer(waitDuration)
	select {
	case ch <- struct{}{}:
		t.Stop()
		err := f()
		<-ch
		return err
	case <-t.C:
		return fmt.Errorf("the server is overloaded with %d concurrent inserts; either increase the number of CPUs or reduce the load", cap(ch))
	}
}
// Do calls f with the limited concurrency.
Do calls f with the limited concurrency.
// Do calls f with the limited concurrency .
func Do(f func() error) error {
	t := time.NewTimer(waitDuration)
	select {
	case ch <- struct{}{}:
		t.Stop()
		err := f()
		<-ch
		return err
	case <-t.C:
		return fmt.Errorf("the server is overloaded with %d concurrent inserts; either increase the number of CPUs or reduce the load", cap(ch))
	}
}
func Do ( f func ( ) error ) error { t := time . NewTimer ( waitDuration ) select { case ch <- struct { } { } : t . Stop ( ) err := f ( ) <- ch return err case <- t . C : return fmt . Errorf ( " " , cap ( ch ) ) } }
Do calls f with the limited concurrency.
Do calls f with the limited concurrency .
// Limit the number of conurrent inserts in order to prevent from excess // memory usage and CPU trashing.