Skip to content

Commit

Permalink
[FAB-17109] Retrieve ReconnectBackoffThreshold as duration
Browse files Browse the repository at this point in the history
Signed-off-by: Tiffany Harris <tiffany.harris@ibm.com>
  • Loading branch information
stephyee authored and mastersingh24 committed Mar 31, 2020
1 parent afbc42f commit 1e51225
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/deliverservice/deliveryclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var logger = flogging.MustGetLogger("deliveryClient")
const (
defaultReConnectTotalTimeThreshold = time.Second * 60 * 60
defaultConnectionTimeout = time.Second * 3
defaultReConnectBackoffThreshold = float64(time.Hour)
defaultReConnectBackoffThreshold = time.Hour
)

func getReConnectTotalTimeThreshold() time.Duration {
Expand All @@ -40,8 +40,8 @@ func getConnectionTimeout() time.Duration {
return util.GetDurationOrDefault("peer.deliveryclient.connTimeout", defaultConnectionTimeout)
}

func getReConnectBackoffThreshold() float64 {
return util.GetFloat64OrDefault("peer.deliveryclient.reConnectBackoffThreshold", defaultReConnectBackoffThreshold)
func getReConnectBackoffThreshold() time.Duration {
return util.GetDurationOrDefault("peer.deliveryclient.reConnectBackoffThreshold", defaultReConnectBackoffThreshold)
}

func staticRootsEnabled() bool {
Expand Down Expand Up @@ -300,7 +300,7 @@ func (d *deliverServiceImpl) newClient(chainID string, ledgerInfoProvider blocks
}
sleepIncrement := float64(time.Millisecond * 500)
attempt := float64(attemptNum)
return time.Duration(math.Min(math.Pow(2, attempt)*sleepIncrement, reconnectBackoffThreshold)), true
return time.Duration(math.Min(math.Pow(2, attempt)*sleepIncrement, float64(reconnectBackoffThreshold))), true
}
connProd := comm.NewConnectionProducer(d.conf.ConnFactory(chainID, d.connConfig.OrdererEndpointOverrides), d.connConfig.toEndpointCriteria())
bClient := NewBroadcastClient(connProd, d.conf.ABCFactory, broadcastSetup, backoffPolicy)
Expand Down

0 comments on commit 1e51225

Please sign in to comment.