grpc-js: Return the result from the UDS resolver only once

This commit is contained in:
Michael Lumish 2023-11-16 10:19:26 -08:00
parent 056738f2ed
commit 736d6df80b

View File

@ -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() {