mirror of
https://github.com/LBRYFoundation/herald.go.git
synced 2025-08-23 17:47:27 +00:00
throttle flood errors like previous hub did
This commit is contained in:
parent
9edba6109f
commit
d71e91c58e
1 changed files with 2 additions and 0 deletions
|
@ -10,6 +10,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
//"github.com/lbryio/hub/schema"
|
//"github.com/lbryio/hub/schema"
|
||||||
|
|
||||||
|
@ -328,6 +329,7 @@ func (s *Server) checkQuery(in *pb.SearchRequest) error {
|
||||||
}
|
}
|
||||||
for name, failed := range checks {
|
for name, failed := range checks {
|
||||||
if failed {
|
if failed {
|
||||||
|
time.Sleep(2) // throttle
|
||||||
return errors.New(fmt.Sprintf("%s cant have more than %d items.", name, limit))
|
return errors.New(fmt.Sprintf("%s cant have more than %d items.", name, limit))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue