Skip to content

Commit

Permalink
Merge "FAB-2787 NodeSDK - add min ping interval"
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaochy1990 authored and Gerrit Code Review committed Feb 22, 2018
2 parents 49404be + bd62382 commit b7418f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fabric-client/lib/ChannelEventHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ const START_ONLY = 1;
const END_ONLY = 2;
const START_AND_END = 3;

const five_minutes_ms = 5*60*1000;


/**
* Transaction processing in fabric v1.1 is a long operation spanning multiple
* components (application, endorsing peer, orderer, committing peer) and takes
Expand Down Expand Up @@ -314,6 +317,7 @@ var ChannelEventHub = class {
let request_timeout_ms = utils.getConfigSetting('request-timeout', 3000);
let request_timeout = request_timeout_ms / 1000;
options = utils.checkAndAddConfigSetting('grpc.keepalive_timeout_ms', request_timeout_ms, options);
options = utils.checkAndAddConfigSetting('grpc.http2.min_time_between_pings_ms', five_minutes_ms, options);

logger.info('_connect - options %j',this._peer._options);
this._event_client = new _eventsProto.Deliver(this._peer._endpoint.addr, this._peer._endpoint.creds, this._peer._options);
Expand Down
2 changes: 2 additions & 0 deletions fabric-client/lib/EventHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var _transProto = grpc.load(__dirname + '/protos/peer/transaction.proto').protos
var _responseProto = grpc.load(__dirname + '/protos/peer/proposal_response.proto').protos;
var _ccProposalProto = grpc.load(__dirname + '/protos/peer/proposal.proto').protos;
var _ccEventProto = grpc.load(__dirname + '/protos/peer/chaincode_event.proto').protos;
const five_minutes_ms = 5*60*1000;

var _validation_codes = {};
var keys = Object.keys(_transProto.TxValidationCode);
Expand Down Expand Up @@ -288,6 +289,7 @@ var EventHub = class {
let request_timeout = request_timeout_ms / 1000;
options = utils.checkAndAddConfigSetting('grpc.http2.keepalive_timeout', request_timeout, options); //grpc 1.2.4
options = utils.checkAndAddConfigSetting('grpc.keepalive_timeout_ms', request_timeout_ms, options); //grpc 1.3.7
options = utils.checkAndAddConfigSetting('grpc.http2.min_time_between_pings_ms', five_minutes_ms, options); //default 5

logger.info('_connect - options %j',this._ep._options);
this._event_client = new _events.Events(this._ep._endpoint.addr, this._ep._endpoint.creds, this._ep._options);
Expand Down

0 comments on commit b7418f8

Please sign in to comment.