From 1ba5bbaf8ec0c2c75286ca3edfc626028ab9b23e Mon Sep 17 00:00:00 2001 From: stephen mcquay Date: Fri, 26 Jan 2018 17:15:05 -0800 Subject: [PATCH] add some bad requests --- hwt.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hwt.go b/hwt.go index e1f5e9d..6fca0fd 100644 --- a/hwt.go +++ b/hwt.go @@ -3,6 +3,8 @@ package hwt import ( "context" fmt "fmt" + "go/src/math/rand" + "time" "github.com/twitchtv/twirp" pb "mcquay.me/hwt/rpc/hwt" @@ -22,6 +24,11 @@ func (s *Server) Hello(ctx context.Context, req *pb.HelloReq) (*pb.HelloResp, er return nil, twirp.InternalErrorWith(err) } + if rand.Int()%100 == 0 { + rest := time.Duration(rand.Intn(50)) * time.Millisecond + time.Sleep(rest) + } + r := &pb.HelloResp{ Text: fmt.Sprintf("%s said: %v", u, req.Subject), Hostname: s.Hostname,