Skip to content

Commit

Permalink
[FAB-3666] Update chaincode.deploytimeout to duration
Browse files Browse the repository at this point in the history
This CR updates the chaincode deploy 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: Ib70c478e3d260cb988b862f1a448eedde963be2a
Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
  • Loading branch information
wlahti committed May 4, 2017
1 parent a4c100c commit a498cc6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions core/chaincode/platforms/golang/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ func getCodeFromHTTP(path string) (codegopath string, err error) {
done <- cmd.Wait()
}()

ccDeployTimeout := viper.GetDuration("chaincode.deploytimeout")
if ccDeployTimeout < time.Duration(30)*time.Second {
logger.Warningf("Invalid chaincode deploy timeout value %s (should be at least 30s); defaulting to 30s", ccDeployTimeout)
ccDeployTimeout = time.Duration(30) * time.Second
} else {
logger.Debugf("Setting chaincode deploy timeout to %s", ccDeployTimeout)
}
select {
case <-time.After(time.Duration(viper.GetInt("chaincode.deploytimeout")) * time.Millisecond):
// If pulling repos takes too long, we should give up
Expand Down
4 changes: 2 additions & 2 deletions sampleconfig/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ chaincode:
# system chaincodes. Default is 30 seconds
executetimeout: 30s

#timeout in millisecs for deploying chaincode from a remote repository.
deploytimeout: 30000
#timeout duration for deploying chaincode from a remote repository.
deploytimeout: 30s

#mode - options are "dev", "net"
#dev - in dev mode, user runs the chaincode after starting validator from
Expand Down

0 comments on commit a498cc6

Please sign in to comment.