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

♻️ Move RTC manager to a service #32728

Merged
merged 1 commit into from Feb 22, 2021
Merged

Conversation

powerivq
Copy link
Contributor

Redo #32386

#32713 Ran into this issue, and this PR has it fixed. The root cause is that different amp-ad elements are incorrectly sharing the same service instance.

Copy link
Contributor

@rcebulko rcebulko left a comment

Choose a reason for hiding this comment

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

Changes to services.js look fine to be, but could you loop in another reviewer who's more familiar with the rest of this code before I sign off? I don't feel confident reviewing this fully.

@powerivq
Copy link
Contributor Author

powerivq commented Feb 18, 2021

@rcebulko sorry, I forgot to add monetization reviewers.

@powerivq powerivq requested a review from lannka February 18, 2021 18:33
return this.getBlockRtc_().then((shouldBlock) =>
shouldBlock
? undefined
: Services.realTimeConfigForDoc(
Copy link
Member

Choose a reason for hiding this comment

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

should we leave this wrapped in a try/catch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It used to be:

if (!! AMP.RealTimeConfigManager) {
    try {
      return new AMP.RealTimeConfigManager(
...

The try/catch, at that time, would prevent rtc issues from breaking the entire runtime. Now that everything is wrapped in the promise and ran asynchronously, the consequence of not using try/catch is much smaller. Throwing exceptions should not be the expected thing anyways, so I feel keeping try/catch nowadays is unnecessarily defensive.

Copy link
Member

@calebcordry calebcordry left a comment

Choose a reason for hiding this comment

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

Approving but perhaps we should consider wrapping this in an experiment if possible, since we already broke it once.

@powerivq
Copy link
Contributor Author

powerivq commented Feb 19, 2021

@calebcordry I would like to, but RTV slots are full now. We can still try looking at the beta numbers (last time I didn't think it helped though).

@powerivq powerivq merged commit 230b86e into ampproject:master Feb 22, 2021
@powerivq powerivq deleted the rtc-service branch February 22, 2021 20:05
caroqliu pushed a commit to caroqliu/amphtml that referenced this pull request Feb 23, 2021
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.

None yet

4 participants