Skip to content

Commit

Permalink
Merge pull request grpc#2546 from murgatroid99/grpc-js_timer_types_up…
Browse files Browse the repository at this point in the history
…date_1.8.x

grpc-js: Switch Timer type to Timeout (1.7.x)
  • Loading branch information
murgatroid99 committed Aug 14, 2023
2 parents 96d288f + 1bc658e commit 88ec019
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/grpc-js/src/backoff-timeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class BackoffTimeout {
* to an object representing a timer that has ended, but it can still be
* interacted with without error.
*/
private timerId: NodeJS.Timer;
private timerId: NodeJS.Timeout;
/**
* Indicates whether the timer is currently running.
*/
Expand Down
20 changes: 10 additions & 10 deletions packages/grpc-js/src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class ChannelImplementation implements Channel {
* the invariant is that callRefTimer is reffed if and only if pickQueue
* is non-empty.
*/
private callRefTimer: NodeJS.Timer;
private callRefTimer: NodeJS.Timeout;
private configSelector: ConfigSelector | null = null;
/**
* This is the error from the name resolver if it failed most recently. It
Expand Down Expand Up @@ -435,12 +435,12 @@ export class ChannelImplementation implements Channel {
metadata: callMetadata,
extraPickInfo: callConfig.pickInformation,
});
const subchannelString = pickResult.subchannel ?
'(' + pickResult.subchannel.getChannelzRef().id + ') ' + pickResult.subchannel.getAddress() :
'' + pickResult.subchannel;
const subchannelString = pickResult.subchannel ?
'(' + pickResult.subchannel.getChannelzRef().id + ') ' + pickResult.subchannel.getAddress() :
'' + pickResult.subchannel;
this.trace(
'Pick result for call [' +
callStream.getCallNumber() +
'Pick result for call [' +
callStream.getCallNumber() +
']: ' +
PickResultType[pickResult.pickResultType] +
' subchannel: ' +
Expand Down Expand Up @@ -602,7 +602,7 @@ export class ChannelImplementation implements Channel {
trace(
LogVerbosity.DEBUG,
'connectivity_state',
'(' + this.channelzRef.id + ') ' +
'(' + this.channelzRef.id + ') ' +
uriToString(this.target) +
' ' +
ConnectivityState[this.connectivityState] +
Expand Down Expand Up @@ -669,9 +669,9 @@ export class ChannelImplementation implements Channel {
/* These dynamicFilters are the mechanism for implementing gRFC A39:
* https://github.com/grpc/proposal/blob/master/A39-xds-http-filters.md
* We run them here instead of with the rest of the filters because
* that spec says "the xDS HTTP filters will run in between name
* that spec says "the xDS HTTP filters will run in between name
* resolution and load balancing".
*
*
* We use the filter stack here to simplify the multi-filter async
* waterfall logic, but we pass along the underlying list of filters
* to avoid having nested filter stacks when combining it with the
Expand Down Expand Up @@ -758,7 +758,7 @@ export class ChannelImplementation implements Channel {
/**
* Get the channelz reference object for this channel. The returned value is
* garbage if channelz is disabled for this channel.
* @returns
* @returns
*/
getChannelzRef() {
return this.channelzRef;
Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-js/src/deadline-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function getDeadline(deadline: number) {
}

export class DeadlineFilter extends BaseFilter implements Filter {
private timer: NodeJS.Timer | null = null;
private timer: NodeJS.Timeout | null = null;
private deadline = Infinity;
constructor(
private readonly channel: Channel,
Expand Down
10 changes: 5 additions & 5 deletions packages/grpc-js/src/load-balancer-outlier-detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ export class OutlierDetectionLoadBalancer implements LoadBalancer {
private childBalancer: ChildLoadBalancerHandler;
private addressMap: Map<string, MapEntry> = new Map<string, MapEntry>();
private latestConfig: OutlierDetectionLoadBalancingConfig | null = null;
private ejectionTimer: NodeJS.Timer;
private ejectionTimer: NodeJS.Timeout;
private timerStartTime: Date | null = null;

constructor(channelControlHelper: ChannelControlHelper) {
Expand Down Expand Up @@ -411,8 +411,8 @@ export class OutlierDetectionLoadBalancer implements LoadBalancer {
}

private isCountingEnabled(): boolean {
return this.latestConfig !== null &&
(this.latestConfig.getSuccessRateEjectionConfig() !== null ||
return this.latestConfig !== null &&
(this.latestConfig.getSuccessRateEjectionConfig() !== null ||
this.latestConfig.getFailurePercentageEjectionConfig() !== null);
}

Expand Down Expand Up @@ -511,7 +511,7 @@ export class OutlierDetectionLoadBalancer implements LoadBalancer {
if (addressesWithTargetVolume < failurePercentageConfig.minimum_hosts) {
return;
}

// Step 2
for (const [address, mapEntry] of this.addressMap.entries()) {
// Step 2.i
Expand Down Expand Up @@ -670,4 +670,4 @@ export function setup() {
if (OUTLIER_DETECTION_ENABLED) {
registerLoadBalancerType(TYPE_NAME, OutlierDetectionLoadBalancer, OutlierDetectionLoadBalancingConfig);
}
}
}
4 changes: 2 additions & 2 deletions packages/grpc-js/src/resolver-dns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class DnsResolver implements Resolver {
private defaultResolutionError: StatusObject;
private backoff: BackoffTimeout;
private continueResolving = false;
private nextResolutionTimer: NodeJS.Timer;
private nextResolutionTimer: NodeJS.Timeout;
private isNextResolutionTimerRunning = false;
constructor(
private target: GrpcUri,
Expand Down Expand Up @@ -132,7 +132,7 @@ class DnsResolver implements Resolver {
details: `Name resolution failed for target ${uriToString(this.target)}`,
metadata: new Metadata(),
};

const backoffOptions: BackoffOptions = {
initialDelay: channelOptions['grpc.initial_reconnect_backoff_ms'],
maxDelay: channelOptions['grpc.max_reconnect_backoff_ms'],
Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-js/src/server-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export class Http2ServerCallStream<
ResponseType
> extends EventEmitter {
cancelled = false;
deadlineTimer: NodeJS.Timer | null = null;
deadlineTimer: NodeJS.Timeout | null = null;
private statusSent = false;
private deadline: Deadline = Infinity;
private wantTrailers = false;
Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-js/src/subchannel-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class SubchannelPool {
/**
* A timer of a task performing a periodic subchannel cleanup.
*/
private cleanupTimer: NodeJS.Timer | null = null;
private cleanupTimer: NodeJS.Timeout | null = null;

/**
* A pool of subchannels use for making connections. Subchannels with the
Expand Down
14 changes: 7 additions & 7 deletions packages/grpc-js/src/subchannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ export class Subchannel {
/**
* Timer reference for timeout that indicates when to send the next ping
*/
private keepaliveIntervalId: NodeJS.Timer;
private keepaliveIntervalId: NodeJS.Timeout;
/**
* Timer reference tracking when the most recent ping will be considered lost
*/
private keepaliveTimeoutId: NodeJS.Timer;
private keepaliveTimeoutId: NodeJS.Timeout;
/**
* Indicates whether keepalive pings should be sent without any active calls
*/
Expand Down Expand Up @@ -884,11 +884,11 @@ export class Subchannel {
);
const streamSession = this.session;
this.internalsTrace(
'session.closed=' +
streamSession!.closed +
' session.destroyed=' +
streamSession!.destroyed +
' session.socket.destroyed=' +
'session.closed=' +
streamSession!.closed +
' session.destroyed=' +
streamSession!.destroyed +
' session.socket.destroyed=' +
streamSession!.socket.destroyed);
let statsTracker: SubchannelCallStatsTracker;
if (this.channelzEnabled) {
Expand Down

0 comments on commit 88ec019

Please sign in to comment.