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(grpc-tools): add omit_serialize_instanceof generator option #2874

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lionello
Copy link

@lionello lionello commented Dec 28, 2024

Fixes #2865

This adds a new flag omit_serialize_instanceof which, when set, omits the instanceof check from the generated JS code. It defaults to false, which retains the current behavior (ie. with the check).

Copy link

linux-foundation-easycla bot commented Dec 28, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: lionello / name: Lio李歐 (0a20c2d)

@lionello lionello force-pushed the lio/omit_request_instanceof branch 2 times, most recently from 1041177 to c6bb399 Compare December 28, 2024 19:46
@lionello lionello changed the title Add omit_request_instanceof generator option Add omit_serialize_instanceof generator option Dec 28, 2024
@lionello lionello force-pushed the lio/omit_request_instanceof branch from c6bb399 to 7221f81 Compare December 28, 2024 20:23
@lionello lionello changed the title Add omit_serialize_instanceof generator option feat(grpc-tools): add omit_serialize_instanceof generator option Jan 6, 2025
@murgatroid99
Copy link
Member

The only difference between the separate serialize_* functions is the instanceof check, so with this option set, the generator should instead generate a single serialize method that is used for serializing every message type.

@lionello
Copy link
Author

lionello commented Jan 9, 2025

The only difference between the separate serialize_* functions is the instanceof check, so with this option set, the generator should instead generate a single serialize method that is used for serializing every message type.

@murgatroid99 I looked into this, and it's certainly possible to fix, but it adds a lot of complexity for little gain. It also no longer allows putting breakpoints on a particular instance of the serialize_* function during debugging, which is something I've done before, so IMHO it's not worth the effort. Unless you tell me it's a requirement to get this merged, I'd vote to merge this as-is.

@lionello
Copy link
Author

lionello commented Jan 10, 2025

Tests appear to be failing with

FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory

and

  1) Name Resolver DNS Names Should resolve a public address:
     Error: Timeout of 4000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
      at listOnTimeout (node:internal/timers:559:17)
      at processTimers (node:internal/timers:502:7)

@murgatroid99
Copy link
Member

Ignore those failures. They're not related to this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make instanceof check optional
3 participants