add some bad requests
This commit is contained in:
parent
bea25aa0d1
commit
1ba5bbaf8e
7
hwt.go
7
hwt.go
@ -3,6 +3,8 @@ package hwt
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
fmt "fmt"
|
fmt "fmt"
|
||||||
|
"go/src/math/rand"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/twitchtv/twirp"
|
"github.com/twitchtv/twirp"
|
||||||
pb "mcquay.me/hwt/rpc/hwt"
|
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)
|
return nil, twirp.InternalErrorWith(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rand.Int()%100 == 0 {
|
||||||
|
rest := time.Duration(rand.Intn(50)) * time.Millisecond
|
||||||
|
time.Sleep(rest)
|
||||||
|
}
|
||||||
|
|
||||||
r := &pb.HelloResp{
|
r := &pb.HelloResp{
|
||||||
Text: fmt.Sprintf("%s said: %v", u, req.Subject),
|
Text: fmt.Sprintf("%s said: %v", u, req.Subject),
|
||||||
Hostname: s.Hostname,
|
Hostname: s.Hostname,
|
||||||
|
Loading…
Reference in New Issue
Block a user