Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: channelz improvements, idle timeout implementation #2677

1 change: 1 addition & 0 deletions packages/grpc-js/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-explicit-any": "off",
"node/no-missing-import": "off",
"node/no-empty-function": "off",
"node/no-unsupported-features/es-syntax": "off",
Expand Down
3 changes: 3 additions & 0 deletions packages/grpc-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ Many channel arguments supported in `grpc` are not supported in `@grpc/grpc-js`.
- `grpc.enable_channelz`
- `grpc.dns_min_time_between_resolutions_ms`
- `grpc.enable_retries`
- `grpc.max_connection_age_ms`
- `grpc.max_connection_age_grace_ms`
- `grpc.max_connection_idle_ms`
- `grpc.per_rpc_retry_buffer_size`
- `grpc.retry_buffer_size`
- `grpc.service_config_disable_resolution`
Expand Down
33 changes: 17 additions & 16 deletions packages/grpc-js/gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ const pkgPath = path.resolve(jsCoreDir, 'package.json');
const supportedVersionRange = require(pkgPath).engines.node;
const versionNotSupported = () => {
console.log(`Skipping grpc-js task for Node ${process.version}`);
return () => { return Promise.resolve(); };
return () => {
return Promise.resolve();
};
};
const identity = (value: any): any => value;
const checkTask = semver.satisfies(process.version, supportedVersionRange) ?
identity : versionNotSupported;
const checkTask = semver.satisfies(process.version, supportedVersionRange)
? identity
: versionNotSupported;

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

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

const copyTestFixtures = checkTask(() => ncpP(`${jsCoreDir}/test/fixtures`, `${outDir}/test/fixtures`));
const copyTestFixtures = checkTask(() =>
ncpP(`${jsCoreDir}/test/fixtures`, `${outDir}/test/fixtures`)
);

const runTests = checkTask(() => {
process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION = 'true';
return gulp.src(`${outDir}/test/**/*.js`)
.pipe(mocha({reporter: 'mocha-jenkins-reporter',
require: ['ts-node/register']}));
return gulp.src(`${outDir}/test/**/*.js`).pipe(
mocha({
reporter: 'mocha-jenkins-reporter',
require: ['ts-node/register'],
})
);
});

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

export {
install,
lint,
clean,
cleanAll,
compile,
test
}
export { install, lint, clean, cleanAll, compile, test };
37 changes: 19 additions & 18 deletions packages/grpc-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
"main": "build/src/index.js",
"engines": {
"node": "^8.13.0 || >=10.10.0"
"node": ">=12.10.0"
},
"keywords": [],
"author": {
Expand All @@ -15,34 +15,35 @@
"types": "build/src/index.d.ts",
"license": "Apache-2.0",
"devDependencies": {
"@types/gulp": "^4.0.6",
"@types/gulp-mocha": "0.0.32",
"@types/lodash": "^4.14.186",
"@types/mocha": "^5.2.6",
"@types/ncp": "^2.0.1",
"@types/pify": "^3.0.2",
"@types/semver": "^7.3.9",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"@typescript-eslint/typescript-estree": "^5.59.11",
"clang-format": "^1.0.55",
"@types/gulp": "^4.0.17",
"@types/gulp-mocha": "0.0.37",
"@types/lodash": "^4.14.202",
"@types/mocha": "^10.0.6",
"@types/ncp": "^2.0.8",
"@types/node": ">=20.11.20",
"@types/pify": "^5.0.4",
"@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"@typescript-eslint/typescript-estree": "^7.1.0",
"clang-format": "^1.8.0",
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"execa": "^2.0.3",
"gulp": "^4.0.2",
"gulp-mocha": "^6.0.0",
"lodash": "^4.17.4",
"lodash": "^4.17.21",
"madge": "^5.0.1",
"mocha-jenkins-reporter": "^0.4.1",
"ncp": "^2.0.0",
"pify": "^4.0.1",
"prettier": "^2.8.8",
"rimraf": "^3.0.2",
"semver": "^7.3.5",
"ts-node": "^10.9.1",
"typescript": "^5.1.3"
"semver": "^7.6.0",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
},
"contributors": [
{
Expand All @@ -65,8 +66,8 @@
"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"
},
"dependencies": {
"@grpc/proto-loader": "^0.7.8",
"@types/node": ">=12.12.47"
"@grpc/proto-loader": "^0.7.10",
"@js-sdsl/ordered-map": "^4.4.2"
},
"files": [
"src/**/*.ts",
Expand Down
1 change: 1 addition & 0 deletions packages/grpc-js/src/channel-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export interface ChannelOptions {
'grpc.retry_buffer_size'?: number;
'grpc.max_connection_age_ms'?: number;
'grpc.max_connection_age_grace_ms'?: number;
'grpc.max_connection_idle_ms'?: number;
'grpc-node.max_session_memory'?: number;
'grpc.service_config_disable_resolution'?: number;
'grpc.client_idle_timeout_ms'?: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-js/src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ChannelOptions } from './channel-options';
import { ServerSurfaceCall } from './server-call';

import { ConnectivityState } from './connectivity-state';
import { ChannelRef } from './channelz';
import type { ChannelRef } from './channelz';
import { Call } from './call-interface';
import { InternalChannel } from './internal-channel';
import { Deadline } from './deadline';
Expand Down
Loading