Skip to content

Commit 400147c

Browse files
authored
Merge pull request #2677 from AVVS/feat/channelz-perf+stream-idle-timeout
feat: channelz improvements, idle timeout implementation
2 parents 210967f + 74ddb3b commit 400147c

19 files changed

+910
-458
lines changed

packages/grpc-js/.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@typescript-eslint/explicit-module-boundary-types": "off",
5151
"@typescript-eslint/ban-types": "off",
5252
"@typescript-eslint/camelcase": "off",
53+
"@typescript-eslint/no-explicit-any": "off",
5354
"node/no-missing-import": "off",
5455
"node/no-empty-function": "off",
5556
"node/no-unsupported-features/es-syntax": "off",

packages/grpc-js/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ Many channel arguments supported in `grpc` are not supported in `@grpc/grpc-js`.
6060
- `grpc.enable_channelz`
6161
- `grpc.dns_min_time_between_resolutions_ms`
6262
- `grpc.enable_retries`
63+
- `grpc.max_connection_age_ms`
64+
- `grpc.max_connection_age_grace_ms`
65+
- `grpc.max_connection_idle_ms`
6366
- `grpc.per_rpc_retry_buffer_size`
6467
- `grpc.retry_buffer_size`
6568
- `grpc.service_config_disable_resolution`

packages/grpc-js/gulpfile.ts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,17 @@ const pkgPath = path.resolve(jsCoreDir, 'package.json');
3535
const supportedVersionRange = require(pkgPath).engines.node;
3636
const versionNotSupported = () => {
3737
console.log(`Skipping grpc-js task for Node ${process.version}`);
38-
return () => { return Promise.resolve(); };
38+
return () => {
39+
return Promise.resolve();
40+
};
3941
};
4042
const identity = (value: any): any => value;
41-
const checkTask = semver.satisfies(process.version, supportedVersionRange) ?
42-
identity : versionNotSupported;
43+
const checkTask = semver.satisfies(process.version, supportedVersionRange)
44+
? identity
45+
: versionNotSupported;
4346

4447
const execNpmVerb = (verb: string, ...args: string[]) =>
45-
execa('npm', [verb, ...args], {cwd: jsCoreDir, stdio: 'inherit'});
48+
execa('npm', [verb, ...args], { cwd: jsCoreDir, stdio: 'inherit' });
4649
const execNpmCommand = execNpmVerb.bind(null, 'run');
4750

4851
const install = checkTask(() => execNpmVerb('install', '--unsafe-perm'));
@@ -64,22 +67,20 @@ const cleanAll = gulp.parallel(clean);
6467
*/
6568
const compile = checkTask(() => execNpmCommand('compile'));
6669

67-
const copyTestFixtures = checkTask(() => ncpP(`${jsCoreDir}/test/fixtures`, `${outDir}/test/fixtures`));
70+
const copyTestFixtures = checkTask(() =>
71+
ncpP(`${jsCoreDir}/test/fixtures`, `${outDir}/test/fixtures`)
72+
);
6873

6974
const runTests = checkTask(() => {
7075
process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION = 'true';
71-
return gulp.src(`${outDir}/test/**/*.js`)
72-
.pipe(mocha({reporter: 'mocha-jenkins-reporter',
73-
require: ['ts-node/register']}));
76+
return gulp.src(`${outDir}/test/**/*.js`).pipe(
77+
mocha({
78+
reporter: 'mocha-jenkins-reporter',
79+
require: ['ts-node/register'],
80+
})
81+
);
7482
});
7583

7684
const test = gulp.series(install, copyTestFixtures, runTests);
7785

78-
export {
79-
install,
80-
lint,
81-
clean,
82-
cleanAll,
83-
compile,
84-
test
85-
}
86+
export { install, lint, clean, cleanAll, compile, test };

packages/grpc-js/package.json

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
77
"main": "build/src/index.js",
88
"engines": {
9-
"node": "^8.13.0 || >=10.10.0"
9+
"node": ">=12.10.0"
1010
},
1111
"keywords": [],
1212
"author": {
@@ -15,34 +15,35 @@
1515
"types": "build/src/index.d.ts",
1616
"license": "Apache-2.0",
1717
"devDependencies": {
18-
"@types/gulp": "^4.0.6",
19-
"@types/gulp-mocha": "0.0.32",
20-
"@types/lodash": "^4.14.186",
21-
"@types/mocha": "^5.2.6",
22-
"@types/ncp": "^2.0.1",
23-
"@types/pify": "^3.0.2",
24-
"@types/semver": "^7.3.9",
25-
"@typescript-eslint/eslint-plugin": "^5.59.11",
26-
"@typescript-eslint/parser": "^5.59.11",
27-
"@typescript-eslint/typescript-estree": "^5.59.11",
28-
"clang-format": "^1.0.55",
18+
"@types/gulp": "^4.0.17",
19+
"@types/gulp-mocha": "0.0.37",
20+
"@types/lodash": "^4.14.202",
21+
"@types/mocha": "^10.0.6",
22+
"@types/ncp": "^2.0.8",
23+
"@types/node": ">=20.11.20",
24+
"@types/pify": "^5.0.4",
25+
"@types/semver": "^7.5.8",
26+
"@typescript-eslint/eslint-plugin": "^7.1.0",
27+
"@typescript-eslint/parser": "^7.1.0",
28+
"@typescript-eslint/typescript-estree": "^7.1.0",
29+
"clang-format": "^1.8.0",
2930
"eslint": "^8.42.0",
3031
"eslint-config-prettier": "^8.8.0",
3132
"eslint-plugin-node": "^11.1.0",
3233
"eslint-plugin-prettier": "^4.2.1",
3334
"execa": "^2.0.3",
3435
"gulp": "^4.0.2",
3536
"gulp-mocha": "^6.0.0",
36-
"lodash": "^4.17.4",
37+
"lodash": "^4.17.21",
3738
"madge": "^5.0.1",
3839
"mocha-jenkins-reporter": "^0.4.1",
3940
"ncp": "^2.0.0",
4041
"pify": "^4.0.1",
4142
"prettier": "^2.8.8",
4243
"rimraf": "^3.0.2",
43-
"semver": "^7.3.5",
44-
"ts-node": "^10.9.1",
45-
"typescript": "^5.1.3"
44+
"semver": "^7.6.0",
45+
"ts-node": "^10.9.2",
46+
"typescript": "^5.3.3"
4647
},
4748
"contributors": [
4849
{
@@ -65,8 +66,8 @@
6566
"generate-test-types": "proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --include-dirs test/fixtures/ -O test/generated/ --grpcLib ../../src/index test_service.proto"
6667
},
6768
"dependencies": {
68-
"@grpc/proto-loader": "^0.7.8",
69-
"@types/node": ">=12.12.47"
69+
"@grpc/proto-loader": "^0.7.10",
70+
"@js-sdsl/ordered-map": "^4.4.2"
7071
},
7172
"files": [
7273
"src/**/*.ts",

packages/grpc-js/src/channel-options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export interface ChannelOptions {
5454
'grpc.retry_buffer_size'?: number;
5555
'grpc.max_connection_age_ms'?: number;
5656
'grpc.max_connection_age_grace_ms'?: number;
57+
'grpc.max_connection_idle_ms'?: number;
5758
'grpc-node.max_session_memory'?: number;
5859
'grpc.service_config_disable_resolution'?: number;
5960
'grpc.client_idle_timeout_ms'?: number;

packages/grpc-js/src/channel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { ChannelOptions } from './channel-options';
2020
import { ServerSurfaceCall } from './server-call';
2121

2222
import { ConnectivityState } from './connectivity-state';
23-
import { ChannelRef } from './channelz';
23+
import type { ChannelRef } from './channelz';
2424
import { Call } from './call-interface';
2525
import { InternalChannel } from './internal-channel';
2626
import { Deadline } from './deadline';

0 commit comments

Comments
 (0)