Skip to content

Commit ed3dd72

Browse files
committed
Add delay before shutdown
1 parent af0844f commit ed3dd72

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

ydb/core/driver_lib/run/run.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,9 @@ static TString ReadFile(const TString& fileName) {
504504
void TKikimrRunner::InitializeGracefulShutdown(const TKikimrRunConfig& runConfig) {
505505
Y_UNUSED(runConfig);
506506
GracefulShutdownSupported = true;
507+
if (runConfig.AppConfig.HasDelayBeforeShutdownSeconds()) {
508+
DelayBeforeShutdown = TDuration::Seconds(runConfig.AppConfig.GetDelayBeforeShutdownSeconds());
509+
}
507510
}
508511

509512
void TKikimrRunner::InitializeKqpController(const TKikimrRunConfig& runConfig) {
@@ -1732,6 +1735,7 @@ void TKikimrRunner::KikimrStop(bool graceful) {
17321735

17331736
if (EnabledGrpcService) {
17341737
ActorSystem->Send(new IEventHandle(NGRpcService::CreateGrpcPublisherServiceActorId(), {}, new TEvents::TEvPoisonPill));
1738+
Sleep(DelayBeforeShutdown);
17351739
}
17361740

17371741
TIntrusivePtr<TDrainProgress> drainProgress(new TDrainProgress());

ydb/core/driver_lib/run/run.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class TKikimrRunner : public virtual TThrRefBase, private IGlobalObjectStorage {
4343

4444
bool EnabledGrpcService = false;
4545
bool GracefulShutdownSupported = false;
46+
TDuration DelayBeforeShutdown;
4647
THolder<NSQS::TAsyncHttpServer> SqsHttp;
4748

4849
THolder<NYdb::TDriver> YdbDriver;

ydb/core/protos/config.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,6 +1989,7 @@ message TAppConfig {
19891989
optional TMemoryControllerConfig MemoryControllerConfig = 81;
19901990
optional TGroupedMemoryLimiterConfig GroupedMemoryLimiterConfig = 82;
19911991
optional NKikimrReplication.TReplicationDefaults ReplicationConfig = 83;
1992+
optional uint32 DelayBeforeShutdownSeconds = 108;
19921993

19931994
repeated TNamedConfig NamedConfigs = 100;
19941995
optional string ClusterYamlConfig = 101;

0 commit comments

Comments
 (0)