Skip to content

Commit 6cb5c01

Browse files
committed
add configurable parameter ping_timeout to slave_options
1 parent 2056bcd commit 6cb5c01

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

config.go

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ type SlaveOptionsConfig struct {
9191
DisableKeySpaceSync bool `json:"disable_keyspace_sync"`
9292
GroupID string `json:"group_id"`
9393
CallTimeout int `json:"call_timeout"`
94+
PingTimeout int `json:"ping_timeout"`
9495
}
9596

9697
type LocalSessionCacheConf struct {

config_utils.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ func loadConfig(filePath string, configStruct *Config) {
7979
if configStruct.SlaveOptions.CallTimeout == 0 {
8080
configStruct.SlaveOptions.CallTimeout = 30
8181
}
82-
82+
if configStruct.SlaveOptions.PingTimeout == 0 {
83+
configStruct.SlaveOptions.PingTimeout = 60
84+
}
85+
GlobalRPCPingTimeout = time.Second * time.Duration(configStruct.SlaveOptions.PingTimeout)
8386
GlobalRPCCallTimeout = time.Second * time.Duration(configStruct.SlaveOptions.CallTimeout)
8487
configStruct.EventTriggers = InitGenericEventHandlers(configStruct.EventHandlers)
8588
}

rpc_storage_handler.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ var RPC_EmergencyModeLoaded bool
5151
var ErrorDenied error = errors.New("Access Denied")
5252

5353
var GlobalRPCCallTimeout time.Duration
54+
var GlobalRPCPingTimeout time.Duration
55+
5456

5557
// ------------------- CLOUD STORAGE MANAGER -------------------------------
5658

@@ -705,7 +707,7 @@ func (r *RPCStorageHandler) GetPolicies(orgId string) string {
705707
// CheckForReload will start a long poll
706708
func (r *RPCStorageHandler) CheckForReload(orgId string) {
707709
log.Debug("[RPC STORE] Check Reload called...")
708-
reload, err := RPCFuncClientSingleton.CallTimeout("CheckReload", orgId, time.Second*60)
710+
reload, err := RPCFuncClientSingleton.CallTimeout("CheckReload", orgId, GlobalRPCPingTimeout)
709711
if err != nil {
710712
if r.IsAccessError(err) {
711713
log.Warning("[RPC STORE] CheckReload: Not logged in")

0 commit comments

Comments
 (0)