v0.0.18.6 добавлены лимиты и параметры для подключения grpc сервиса в main.go
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
7cbf071532
commit
ced1697f39
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
"google.golang.org/grpc/keepalive"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@ -31,8 +32,17 @@ func main() {
|
|||||||
}
|
}
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
// Подключение к gRPC серверу сообщений
|
grpcConn, err := grpc.Dial(
|
||||||
grpcConn, err := grpc.Dial(cfg.GRPC.MessageServiceAddress, grpc.WithInsecure())
|
cfg.GRPC.MessageServiceAddress,
|
||||||
|
grpc.WithInsecure(),
|
||||||
|
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
||||||
|
Time: 30 * time.Second, // Отправлять keepalive-пакеты каждые 30 сек
|
||||||
|
Timeout: 10 * time.Second, // Ждать ответа 10 сек
|
||||||
|
PermitWithoutStream: true, // Отправлять keepalive даже без активных стримов
|
||||||
|
}),
|
||||||
|
grpc.WithDefaultCallOptions(
|
||||||
|
grpc.MaxCallRecvMsgSize(10*1024*1024), // Увеличить лимит размера сообщения (опционально)
|
||||||
|
))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to connect to messages gRPC service: %v", err)
|
log.Fatalf("failed to connect to messages gRPC service: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user