throttle flood errors like previous hub did

This commit is contained in:
Victor Shyba 2021-08-13 16:04:12 -03:00
parent 9edba6109f
commit d71e91c58e

View file

@ -10,6 +10,7 @@ import (
"math"
"reflect"
"strings"
"time"
//"github.com/lbryio/hub/schema"
@ -328,6 +329,7 @@ func (s *Server) checkQuery(in *pb.SearchRequest) error {
}
for name, failed := range checks {
if failed {
time.Sleep(2) // throttle
return errors.New(fmt.Sprintf("%s cant have more than %d items.", name, limit))
}
}