Skip to content

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

Merged
sampajano merged 1 commit into
grpc:masterfrom
sampajano:1-fix-deadline-crash
Nov 19, 2021
Merged

Fix issue where no RPC is issued when deadline is specified.#1172
sampajano merged 1 commit into
grpc:masterfrom
sampajano:1-fix-deadline-crash

Conversation

@sampajano

@sampajano sampajano commented Nov 19, 2021

Copy link
Copy Markdown
Collaborator

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

@stanley-cheung stanley-cheung left a comment

Copy link
Copy Markdown
Collaborator

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