Skip to content

Commit 736d6df

Browse files
committed
grpc-js: Return the result from the UDS resolver only once
1 parent 056738f commit 736d6df

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

packages/grpc-js/src/resolver-uds.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { ChannelOptions } from './channel-options';
2121

2222
class UdsResolver implements Resolver {
2323
private addresses: SubchannelAddress[] = [];
24+
private hasReturnedResult = false;
2425
constructor(
2526
target: GrpcUri,
2627
private listener: ResolverListener,
@@ -35,14 +36,17 @@ class UdsResolver implements Resolver {
3536
this.addresses = [{ path }];
3637
}
3738
updateResolution(): void {
38-
process.nextTick(
39-
this.listener.onSuccessfulResolution,
40-
this.addresses,
41-
null,
42-
null,
43-
null,
44-
{}
45-
);
39+
if (!this.hasReturnedResult) {
40+
this.hasReturnedResult = true;
41+
process.nextTick(
42+
this.listener.onSuccessfulResolution,
43+
this.addresses,
44+
null,
45+
null,
46+
null,
47+
{}
48+
);
49+
}
4650
}
4751

4852
destroy() {

0 commit comments

Comments
 (0)