Skip to content

Commit

Permalink
[FAB-3665] Update chaincode.executetimeout to duration
Browse files Browse the repository at this point in the history
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 <wtlahti@us.ibm.com>
  • Loading branch information
wlahti committed May 4, 2017
1 parent 04e9a3f commit a4c100c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions core/chaincode/chaincode_support.go
Expand Up @@ -169,16 +169,16 @@ func NewChaincodeSupport(getPeerEndpoint func() (*pb.PeerEndpoint, error), userr
theChaincodeSupport.keepalive = time.Duration(t) * time.Second
}

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

theChaincodeSupport.executetimeout = time.Duration(execto) * time.Millisecond
theChaincodeSupport.executetimeout = execto

viper.SetEnvPrefix("CORE")
viper.AutomaticEnv()
Expand Down
2 changes: 1 addition & 1 deletion core/scc/cscc/configure_test.go
Expand Up @@ -135,7 +135,7 @@ func TestConfigerInvokeJoinChainCorrectParams(t *testing.T) {
sysccprovider.RegisterSystemChaincodeProviderFactory(&scc.MocksccProviderFactory{})

viper.Set("peer.fileSystemPath", "/tmp/hyperledgertest/")
viper.Set("chaincode.executetimeout", "3000")
viper.Set("chaincode.executetimeout", "3s")
os.Mkdir("/tmp/hyperledgertest", 0755)

peer.MockInitialize()
Expand Down
6 changes: 3 additions & 3 deletions sampleconfig/core.yaml
Expand Up @@ -301,10 +301,10 @@ chaincode:
# to come through. 1sec should be plenty for chaincode unit tests
startuptimeout: 300s

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

#timeout in millisecs for deploying chaincode from a remote repository.
deploytimeout: 30000
Expand Down

0 comments on commit a4c100c

Please sign in to comment.