mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-04-20 17:56:41 +00:00
22 lines
454 B
Go
22 lines
454 B
Go
package grpc
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
pb "github.com/stefanprodan/podinfo/pkg/api/grpc/delay"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
type DelayServer struct {
|
|
pb.UnimplementedDelayServiceServer
|
|
config *Config
|
|
logger *zap.Logger
|
|
}
|
|
|
|
func (s *DelayServer) Delay(ctx context.Context, delayInput *pb.DelayRequest) (*pb.DelayResponse, error) {
|
|
|
|
time.Sleep(time.Duration(delayInput.Seconds) * time.Second)
|
|
return &pb.DelayResponse{Message: delayInput.Seconds}, nil
|
|
}
|