File tree Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 1
1
#include " core_ydb.h"
2
2
#include " core_ydb_impl.h"
3
+ #include " mvp_tokens.h"
3
4
4
5
#include < ydb/library/actors/http/http_cache.h>
5
6
@@ -408,3 +409,10 @@ TString GetAuthHeaderValue(const TString& tokenName) {
408
409
}
409
410
return authHeaderValue;
410
411
}
412
+
413
+ void SetGrpcKeepAlive (NYdbGrpc::TGRpcClientConfig& config) {
414
+ config.IntChannelParams [GRPC_ARG_KEEPALIVE_TIME_MS] = 20000 ;
415
+ config.IntChannelParams [GRPC_ARG_KEEPALIVE_TIMEOUT_MS] = 10000 ;
416
+ config.IntChannelParams [GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA] = 0 ;
417
+ config.IntChannelParams [GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS] = 1 ;
418
+ }
Original file line number Diff line number Diff line change 16
16
#include < util/generic/strbuf.h>
17
17
#include < library/cpp/deprecated/atomic/atomic.h>
18
18
#include " grpc_log.h"
19
- #include " mvp_tokens.h"
20
19
21
20
template <typename T>
22
21
class TAtomicSingleton {
@@ -142,6 +141,9 @@ struct TYdbUnitResources {
142
141
143
142
extern TMap<std::pair<TStringBuf, TStringBuf>, TYdbUnitResources> DefaultUnitResources;
144
143
144
+ TString GetAuthHeaderValue (const TString& tokenName);
145
+ void SetGrpcKeepAlive (NYdbGrpc::TGRpcClientConfig& config);
146
+
145
147
struct TYdbLocation {
146
148
TString Name;
147
149
TString Environment;
@@ -257,6 +259,7 @@ struct TYdbLocation {
257
259
config.SslCredentials .pem_root_certs = certificate;
258
260
}
259
261
config.EnableSsl = ssl;
262
+ SetGrpcKeepAlive (config);
260
263
return CreateGRpcServiceConnection<TGRpcService>(config);
261
264
}
262
265
@@ -272,6 +275,7 @@ struct TYdbLocation {
272
275
if (config.EnableSsl && CaCertificate) {
273
276
config.SslCredentials .pem_root_certs = CaCertificate;
274
277
}
278
+ SetGrpcKeepAlive (config);
275
279
return CreateGRpcServiceConnection<TGRpcService>(config);
276
280
}
277
281
@@ -350,5 +354,3 @@ struct TYdbLocation {
350
354
return GRpcClientLow.GetRef ();
351
355
}
352
356
};
353
-
354
- TString GetAuthHeaderValue (const TString& tokenName);
Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ class TMvpTokenator : public NActors::TActorBootstrapped<TMvpTokenator> {
140
140
NYdbGrpc::TGRpcClientConfig config;
141
141
config.Locator = host;
142
142
config.EnableSsl = (scheme == " grpcs" );
143
+ SetGrpcKeepAlive (config);
143
144
return std::unique_ptr<NMVP::TLoggedGrpcServiceConnection<TGRpcService>>(new NMVP::TLoggedGrpcServiceConnection<TGRpcService>(config, GRpcClientLow.CreateGRpcServiceConnection <TGRpcService>(config)));
144
145
}
145
146
Original file line number Diff line number Diff line change 6
6
#include < ydb/library/actors/core/event_local.h>
7
7
#include < ydb/library/actors/http/http.h>
8
8
#include < ydb/library/grpc/client/grpc_client_low.h>
9
+ #include < ydb/mvp/core/core_ydb.h>
9
10
#include " context.h"
10
11
11
12
@@ -60,6 +61,7 @@ std::unique_ptr<NYdbGrpc::TServiceConnection<TSessionService>> CreateGRpcService
60
61
config.Locator = host;
61
62
config.EnableSsl = (scheme == " grpcs" );
62
63
static NYdbGrpc::TGRpcClientLow client;
64
+ SetGrpcKeepAlive (config);
63
65
return client.CreateGRpcServiceConnection <TSessionService>(config);
64
66
}
65
67
You can’t perform that action at this time.
0 commit comments