mirror of
https://github.com/grpc/grpc-node.git
synced 2026-01-25 14:27:06 +00:00
grpc-js: Return the result from the UDS resolver only once
This commit is contained in:
parent
056738f2ed
commit
736d6df80b
@ -21,6 +21,7 @@ import { ChannelOptions } from './channel-options';
|
||||
|
||||
class UdsResolver implements Resolver {
|
||||
private addresses: SubchannelAddress[] = [];
|
||||
private hasReturnedResult = false;
|
||||
constructor(
|
||||
target: GrpcUri,
|
||||
private listener: ResolverListener,
|
||||
@ -35,14 +36,17 @@ class UdsResolver implements Resolver {
|
||||
this.addresses = [{ path }];
|
||||
}
|
||||
updateResolution(): void {
|
||||
process.nextTick(
|
||||
this.listener.onSuccessfulResolution,
|
||||
this.addresses,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{}
|
||||
);
|
||||
if (!this.hasReturnedResult) {
|
||||
this.hasReturnedResult = true;
|
||||
process.nextTick(
|
||||
this.listener.onSuccessfulResolution,
|
||||
this.addresses,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user