From d71e91c58ef5fec521c89b28e28be494ba11764b Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Fri, 13 Aug 2021 16:04:12 -0300 Subject: [PATCH] throttle flood errors like previous hub did --- server/search.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/search.go b/server/search.go index e1b84f5..1511110 100644 --- a/server/search.go +++ b/server/search.go @@ -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)) } }