v.0.0.3.4 Добавлены лимиты и параметры при создании grpc сервера
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b81f439eaf
commit
ae91ab0dac
11
server.go
11
server.go
@ -9,6 +9,7 @@ import (
|
||||
amqp "github.com/rabbitmq/amqp091-go"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/keepalive"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
"log"
|
||||
@ -482,7 +483,15 @@ func main() {
|
||||
}(&rabbitConn, &sync.Mutex{})
|
||||
|
||||
// Создаем gRPC сервер
|
||||
grpcServer := grpc.NewServer()
|
||||
grpcServer := grpc.NewServer(
|
||||
grpc.KeepaliveParams(keepalive.ServerParameters{
|
||||
MaxConnectionIdle: 5 * time.Minute, // Макс время бездействия соединения
|
||||
MaxConnectionAge: 30 * time.Minute, // Макс время жизни соединения
|
||||
MaxConnectionAgeGrace: 5 * time.Second, // Время на завершение операций
|
||||
Time: 30 * time.Second, // Отправлять keepalive каждые 30 сек
|
||||
Timeout: 5 * time.Second, // Ждать ответа 5 сек
|
||||
}),
|
||||
)
|
||||
proto.RegisterMessageServiceServer(grpcServer, NewServer(pool, rabbitConn))
|
||||
|
||||
// Запускаем сервер
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user