mirror of https://github.com/grpc/grpc-node.git
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:
commit
667bae6412
|
@ -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…
Reference in New Issue