File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @grpc/grpc-js" ,
3- "version" : " 1.9.8 " ,
3+ "version" : " 1.9.9 " ,
44 "description" : " gRPC Library for Node - pure JS implementation" ,
55 "homepage" : " https://grpc.io/" ,
66 "repository" : " https://github.com/grpc/grpc-node/tree/master/packages/grpc-js" ,
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ class DnsResolver implements Resolver {
9999 private nextResolutionTimer : NodeJS . Timeout ;
100100 private isNextResolutionTimerRunning = false ;
101101 private isServiceConfigEnabled = true ;
102+ private returnedIpResult = false ;
102103 constructor (
103104 private target : GrpcUri ,
104105 private listener : ResolverListener ,
@@ -163,16 +164,19 @@ class DnsResolver implements Resolver {
163164 */
164165 private startResolution ( ) {
165166 if ( this . ipResult !== null ) {
166- trace ( 'Returning IP address for target ' + uriToString ( this . target ) ) ;
167- setImmediate ( ( ) => {
168- this . listener . onSuccessfulResolution (
169- this . ipResult ! ,
170- null ,
171- null ,
172- null ,
173- { }
174- ) ;
175- } ) ;
167+ if ( ! this . returnedIpResult ) {
168+ trace ( 'Returning IP address for target ' + uriToString ( this . target ) ) ;
169+ setImmediate ( ( ) => {
170+ this . listener . onSuccessfulResolution (
171+ this . ipResult ! ,
172+ null ,
173+ null ,
174+ null ,
175+ { }
176+ ) ;
177+ } ) ;
178+ this . returnedIpResult = true ;
179+ }
176180 this . backoff . stop ( ) ;
177181 this . backoff . reset ( ) ;
178182 this . stopNextResolutionTimer ( ) ;
@@ -380,6 +384,7 @@ class DnsResolver implements Resolver {
380384 this . latestLookupResult = null ;
381385 this . latestServiceConfig = null ;
382386 this . latestServiceConfigError = null ;
387+ this . returnedIpResult = false ;
383388 }
384389
385390 /**
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ const DEFAULT_PORT = 443;
4141class IpResolver implements Resolver {
4242 private addresses : SubchannelAddress [ ] = [ ] ;
4343 private error : StatusObject | null = null ;
44+ private hasReturnedResult = false ;
4445 constructor (
4546 target : GrpcUri ,
4647 private listener : ResolverListener ,
@@ -87,22 +88,25 @@ class IpResolver implements Resolver {
8788 trace ( 'Parsed ' + target . scheme + ' address list ' + this . addresses ) ;
8889 }
8990 updateResolution ( ) : void {
90- process . nextTick ( ( ) => {
91- if ( this . error ) {
92- this . listener . onError ( this . error ) ;
93- } else {
94- this . listener . onSuccessfulResolution (
95- this . addresses ,
96- null ,
97- null ,
98- null ,
99- { }
100- ) ;
101- }
102- } ) ;
91+ if ( ! this . hasReturnedResult ) {
92+ this . hasReturnedResult = true ;
93+ process . nextTick ( ( ) => {
94+ if ( this . error ) {
95+ this . listener . onError ( this . error ) ;
96+ } else {
97+ this . listener . onSuccessfulResolution (
98+ this . addresses ,
99+ null ,
100+ null ,
101+ null ,
102+ { }
103+ ) ;
104+ }
105+ } ) ;
106+ }
103107 }
104108 destroy ( ) : void {
105- // This resolver owns no resources, so we do nothing here.
109+ this . hasReturnedResult = false ;
106110 }
107111
108112 static getDefaultAuthority ( target : GrpcUri ) : string {
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ describe('Shuffler', () => {
9797 } ) ;
9898} ) ;
9999
100- describe . only ( 'pick_first load balancing policy' , ( ) => {
100+ describe ( 'pick_first load balancing policy' , ( ) => {
101101 const config = new PickFirstLoadBalancingConfig ( false ) ;
102102 let subchannels : MockSubchannel [ ] = [ ] ;
103103 const baseChannelControlHelper : ChannelControlHelper = {
You can’t perform that action at this time.
0 commit comments