Skip to content

Commit

Permalink
[FAB-3664] Update chaincode.startuptimeout to duration
Browse files Browse the repository at this point in the history
This CR updates the chaincode startup 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: Ib896808b52f15e7320641302d5ed21ffbc2a6c62
Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
  • Loading branch information
wlahti committed May 4, 2017
1 parent 3f35491 commit 04e9a3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions peer/node/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"os"
"os/signal"
"path/filepath"
"strconv"
"strings"
"syscall"
"time"
Expand Down Expand Up @@ -296,12 +295,13 @@ func registerChaincodeSupport(grpcServer *grpc.Server) {
userRunsCC := chaincode.IsDevMode()

//get chaincode startup timeout
tOut, err := strconv.Atoi(viper.GetString("chaincode.startuptimeout"))
if err != nil { //what went wrong ?
logger.Warning("could not retrieve timeout var...setting to 5secs")
tOut = 5000
ccStartupTimeout := viper.GetDuration("chaincode.startuptimeout")
if ccStartupTimeout < time.Duration(5)*time.Second {
logger.Warningf("Invalid chaincode startup timeout value %s (should be at least 5s); defaulting to 5s", ccStartupTimeout)
ccStartupTimeout = time.Duration(5) * time.Second
} else {
logger.Debugf("Chaincode startup timeout value set to %s", ccStartupTimeout)
}
ccStartupTimeout := time.Duration(tOut) * time.Millisecond

ccSrv := chaincode.NewChaincodeSupport(peer.GetPeerEndpoint, userRunsCC, ccStartupTimeout)

Expand Down
4 changes: 2 additions & 2 deletions sampleconfig/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ chaincode:
Dockerfile: |
from $(DOCKER_NS)/fabric-javaenv:$(ARCH)-$(PROJECT_VERSION)
# timeout in millisecs for starting up a container and waiting for Register
# timeout duration for starting up a container and waiting for Register
# to come through. 1sec should be plenty for chaincode unit tests
startuptimeout: 300000
startuptimeout: 300s

# timeout in millisecs for invokes and initialize commands
# this timeout is used by all chaincodes in all the channels including
Expand Down

0 comments on commit 04e9a3f

Please sign in to comment.