Skip to content

Commit a4c100c

Browse files
committed
[FAB-3665] Update chaincode.executetimeout to duration
This CR updates the chaincode execute timeout from an integer to a time duration. This has been done for consistency with other timeouts defined for the peer and orderer. Change-Id: Icd0fba2838703ad10a0a17daeedfd5a48e051f4f Signed-off-by: Will Lahti <[email protected]>
1 parent 04e9a3f commit a4c100c

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

core/chaincode/chaincode_support.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,16 @@ func NewChaincodeSupport(getPeerEndpoint func() (*pb.PeerEndpoint, error), userr
169169
theChaincodeSupport.keepalive = time.Duration(t) * time.Second
170170
}
171171

172-
//default chaincode execute timeout is 30000ms (30 secs)
173-
execto := 30000
174-
if eto := viper.GetInt("chaincode.executetimeout"); eto <= 1000 {
175-
chaincodeLogger.Errorf("Invalid execute timeout value %d (should be at least 1000ms) defaulting to %d ms", eto, execto)
172+
//default chaincode execute timeout is 30 secs
173+
execto := time.Duration(30) * time.Second
174+
if eto := viper.GetDuration("chaincode.executetimeout"); eto <= time.Duration(1)*time.Second {
175+
chaincodeLogger.Errorf("Invalid execute timeout value %s (should be at least 1s); defaulting to %s", eto, execto)
176176
} else {
177-
chaincodeLogger.Debugf("Setting execute timeout value to %d ms", eto)
177+
chaincodeLogger.Debugf("Setting execute timeout value to %s", eto)
178178
execto = eto
179179
}
180180

181-
theChaincodeSupport.executetimeout = time.Duration(execto) * time.Millisecond
181+
theChaincodeSupport.executetimeout = execto
182182

183183
viper.SetEnvPrefix("CORE")
184184
viper.AutomaticEnv()

core/scc/cscc/configure_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func TestConfigerInvokeJoinChainCorrectParams(t *testing.T) {
135135
sysccprovider.RegisterSystemChaincodeProviderFactory(&scc.MocksccProviderFactory{})
136136

137137
viper.Set("peer.fileSystemPath", "/tmp/hyperledgertest/")
138-
viper.Set("chaincode.executetimeout", "3000")
138+
viper.Set("chaincode.executetimeout", "3s")
139139
os.Mkdir("/tmp/hyperledgertest", 0755)
140140

141141
peer.MockInitialize()

sampleconfig/core.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,10 @@ chaincode:
301301
# to come through. 1sec should be plenty for chaincode unit tests
302302
startuptimeout: 300s
303303

304-
# timeout in millisecs for invokes and initialize commands
304+
# timeout duration for invokes and initialize commands
305305
# this timeout is used by all chaincodes in all the channels including
306-
# system chaincodes. Default is 30000ms (30 seconds)
307-
executetimeout: 30000
306+
# system chaincodes. Default is 30 seconds
307+
executetimeout: 30s
308308

309309
#timeout in millisecs for deploying chaincode from a remote repository.
310310
deploytimeout: 30000

0 commit comments

Comments
 (0)