File tree Expand file tree Collapse file tree 4 files changed +35
-26
lines changed Expand file tree Collapse file tree 4 files changed +35
-26
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @grpc/grpc-js" ,
3
- "version" : " 1.9.8 " ,
3
+ "version" : " 1.9.9 " ,
4
4
"description" : " gRPC Library for Node - pure JS implementation" ,
5
5
"homepage" : " https://grpc.io/" ,
6
6
"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 {
99
99
private nextResolutionTimer : NodeJS . Timeout ;
100
100
private isNextResolutionTimerRunning = false ;
101
101
private isServiceConfigEnabled = true ;
102
+ private returnedIpResult = false ;
102
103
constructor (
103
104
private target : GrpcUri ,
104
105
private listener : ResolverListener ,
@@ -163,16 +164,19 @@ class DnsResolver implements Resolver {
163
164
*/
164
165
private startResolution ( ) {
165
166
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
+ }
176
180
this . backoff . stop ( ) ;
177
181
this . backoff . reset ( ) ;
178
182
this . stopNextResolutionTimer ( ) ;
@@ -380,6 +384,7 @@ class DnsResolver implements Resolver {
380
384
this . latestLookupResult = null ;
381
385
this . latestServiceConfig = null ;
382
386
this . latestServiceConfigError = null ;
387
+ this . returnedIpResult = false ;
383
388
}
384
389
385
390
/**
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ const DEFAULT_PORT = 443;
41
41
class IpResolver implements Resolver {
42
42
private addresses : SubchannelAddress [ ] = [ ] ;
43
43
private error : StatusObject | null = null ;
44
+ private hasReturnedResult = false ;
44
45
constructor (
45
46
target : GrpcUri ,
46
47
private listener : ResolverListener ,
@@ -87,22 +88,25 @@ class IpResolver implements Resolver {
87
88
trace ( 'Parsed ' + target . scheme + ' address list ' + this . addresses ) ;
88
89
}
89
90
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
+ }
103
107
}
104
108
destroy ( ) : void {
105
- // This resolver owns no resources, so we do nothing here.
109
+ this . hasReturnedResult = false ;
106
110
}
107
111
108
112
static getDefaultAuthority ( target : GrpcUri ) : string {
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ describe('Shuffler', () => {
97
97
} ) ;
98
98
} ) ;
99
99
100
- describe . only ( 'pick_first load balancing policy' , ( ) => {
100
+ describe ( 'pick_first load balancing policy' , ( ) => {
101
101
const config = new PickFirstLoadBalancingConfig ( false ) ;
102
102
let subchannels : MockSubchannel [ ] = [ ] ;
103
103
const baseChannelControlHelper : ChannelControlHelper = {
You can’t perform that action at this time.
0 commit comments