mirror of https://github.com/grpc/grpc-node.git
Merge pull request #1987 from cosmin19/bugfix/grpc-js-pass-backoff-options-to-backofftimeout
grpc-js: Send backoffOptions to BackoffTimeout
This commit is contained in:
commit
0a40a79dd3
|
@ -26,7 +26,7 @@ import { ConnectivityState } from './connectivity-state';
|
||||||
import { ConfigSelector, createResolver, Resolver } from './resolver';
|
import { ConfigSelector, createResolver, Resolver } from './resolver';
|
||||||
import { ServiceError } from './call';
|
import { ServiceError } from './call';
|
||||||
import { Picker, UnavailablePicker, QueuePicker } from './picker';
|
import { Picker, UnavailablePicker, QueuePicker } from './picker';
|
||||||
import { BackoffTimeout } from './backoff-timeout';
|
import { BackoffOptions, BackoffTimeout } from './backoff-timeout';
|
||||||
import { Status } from './constants';
|
import { Status } from './constants';
|
||||||
import { StatusObject } from './call-stream';
|
import { StatusObject } from './call-stream';
|
||||||
import { Metadata } from './metadata';
|
import { Metadata } from './metadata';
|
||||||
|
@ -248,7 +248,10 @@ export class ResolvingLoadBalancer implements LoadBalancer {
|
||||||
},
|
},
|
||||||
channelOptions
|
channelOptions
|
||||||
);
|
);
|
||||||
|
const backoffOptions: BackoffOptions = {
|
||||||
|
initialDelay: channelOptions['grpc.initial_reconnect_backoff_ms'],
|
||||||
|
maxDelay: channelOptions['grpc.max_reconnect_backoff_ms'],
|
||||||
|
};
|
||||||
this.backoffTimeout = new BackoffTimeout(() => {
|
this.backoffTimeout = new BackoffTimeout(() => {
|
||||||
if (this.continueResolving) {
|
if (this.continueResolving) {
|
||||||
this.updateResolution();
|
this.updateResolution();
|
||||||
|
@ -256,7 +259,7 @@ export class ResolvingLoadBalancer implements LoadBalancer {
|
||||||
} else {
|
} else {
|
||||||
this.updateState(this.latestChildState, this.latestChildPicker);
|
this.updateState(this.latestChildState, this.latestChildPicker);
|
||||||
}
|
}
|
||||||
});
|
}, backoffOptions);
|
||||||
this.backoffTimeout.unref();
|
this.backoffTimeout.unref();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue