add some bad requests

This commit is contained in:
Stephen McQuay 2018-01-26 17:15:05 -08:00
parent bea25aa0d1
commit 1ba5bbaf8e
Signed by: sm
GPG Key ID: 4E4B72F479BA3CE5
1 changed files with 7 additions and 0 deletions

7
hwt.go
View File

@ -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,