mirror of https://github.com/grpc/grpc-node.git
grpc-js-xds: Handle all ways control-plane streams can end
This commit is contained in:
parent
5adea403ca
commit
19206e6d9f
|
@ -459,18 +459,22 @@ export class XdsClient {
|
||||||
this.adsCall.on('data', (message: DiscoveryResponse__Output) => {
|
this.adsCall.on('data', (message: DiscoveryResponse__Output) => {
|
||||||
this.handleAdsResponse(message);
|
this.handleAdsResponse(message);
|
||||||
});
|
});
|
||||||
this.adsCall.on('error', (error: ServiceError) => {
|
this.adsCall.on('status', (streamStatus: StatusObject) => {
|
||||||
trace(
|
trace(
|
||||||
'ADS stream ended. code=' + error.code + ' details= ' + error.details
|
'ADS stream ended. code=' + streamStatus.code + ' details= ' + streamStatus.details
|
||||||
);
|
);
|
||||||
this.adsCall = null;
|
this.adsCall = null;
|
||||||
this.reportStreamError(error);
|
if (streamStatus.code !== status.OK) {
|
||||||
|
this.reportStreamError(streamStatus);
|
||||||
|
}
|
||||||
/* If the backoff timer is no longer running, we do not need to wait any
|
/* If the backoff timer is no longer running, we do not need to wait any
|
||||||
* more to start the new call. */
|
* more to start the new call. */
|
||||||
if (!this.adsBackoff.isRunning()) {
|
if (!this.adsBackoff.isRunning()) {
|
||||||
this.maybeStartAdsStream();
|
this.maybeStartAdsStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
this.adsCall.on('error', () => {});
|
||||||
|
|
||||||
const allTypeUrls: AdsTypeUrl[] = [
|
const allTypeUrls: AdsTypeUrl[] = [
|
||||||
EDS_TYPE_URL,
|
EDS_TYPE_URL,
|
||||||
|
@ -611,9 +615,9 @@ export class XdsClient {
|
||||||
this.latestLrsSettings = message;
|
this.latestLrsSettings = message;
|
||||||
receivedSettingsForThisStream = true;
|
receivedSettingsForThisStream = true;
|
||||||
});
|
});
|
||||||
this.lrsCall.on('error', (error: ServiceError) => {
|
this.lrsCall.on('status', (streamStatus: StatusObject) => {
|
||||||
trace(
|
trace(
|
||||||
'LRS stream ended. code=' + error.code + ' details= ' + error.details
|
'LRS stream ended. code=' + streamStatus.code + ' details= ' + streamStatus.details
|
||||||
);
|
);
|
||||||
this.lrsCall = null;
|
this.lrsCall = null;
|
||||||
clearInterval(this.statsTimer);
|
clearInterval(this.statsTimer);
|
||||||
|
@ -623,6 +627,7 @@ export class XdsClient {
|
||||||
this.maybeStartLrsStream();
|
this.maybeStartLrsStream();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.lrsCall.on('error', () => {});
|
||||||
/* Send buffered stats information when starting LRS stream. If there is no
|
/* Send buffered stats information when starting LRS stream. If there is no
|
||||||
* buffered stats information, it will still send the node field. */
|
* buffered stats information, it will still send the node field. */
|
||||||
this.sendStats();
|
this.sendStats();
|
||||||
|
|
Loading…
Reference in New Issue