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

Fix issue where no RPC is issued when deadline is specified. #1172

Merged
merged 1 commit into from
Nov 19, 2021

Conversation

sampajano
Copy link
Collaborator

@sampajano sampajano commented Nov 19, 2021

The issue

This is a temporary hack to fix #1153, which is caused by goog.global not properly pointing to the proper global scope (e.g. window) when grpc-web is being imported as a CommonJS module (because this points to the module scope instead of actual global scope (i.e. globalThis)).

goog.Timer.defaultTimerObject is set to point to goog.global, and that's why it throws when setTimeout is called on it.

The fix

  • In this fix, we'll try to use globalThis when possible, and if it's not available (pre-2020 browsers, etc.), fallback to self, which should work in both browsers and workers.
  • Also added an interop test to verify the fix works (the new test fails without the fix)

@sampajano sampajano force-pushed the 1-fix-deadline-crash branch 2 times, most recently from 19d0f39 to fb0d2f1 Compare November 19, 2021 02:37
Copy link
Collaborator

@stanley-cheung stanley-cheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sampajano sampajano force-pushed the 1-fix-deadline-crash branch 3 times, most recently from d0b6e11 to 986426f Compare November 19, 2021 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem with deadline after switching to 1.3.0
2 participants