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,