Merge pull request #2618 from murgatroid99/grpc-js_uds_return_once

grpc-js: Return the result from the UDS resolver only once
This commit is contained in:
Michael Lumish 2023-11-16 11:30:03 -08:00 committed by GitHub
commit 667bae6412
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 8 deletions

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