Skip to content

Fix lts#781

Merged
sebastianbenz merged 3 commits intomasterfrom
fix-lts
May 20, 2020
Merged

Fix lts#781
sebastianbenz merged 3 commits intomasterfrom
fix-lts

Conversation

@sebastianbenz
Copy link
Copy Markdown
Collaborator

The new runtime parameter handling resulted in the LTS option no longer
working. Moving lts + ampRuntimeVersion in fetchRuntimeParameters.

This PR also improves logging and fixes a bug where the styles fallback
did not work.

The new runtime parameter handling resulted in the LTS option no longer
working. Moving lts + ampRuntimeVersion in fetchRuntimeParameters.

This PR also improves logging and fixes a bug where the styles fallback
did not work.

Fixes #777
Fallback to cdn.ampproject.org if custom runtime host cannot be
resolved
@sebastianbenz
Copy link
Copy Markdown
Collaborator Author

@mdmower would be great if you could take a look.


function calculateHost({ampUrlPrefix = AMP_CACHE_HOST, ampRuntimeVersion, lts, rtv = false}) {
if (lts && ampRuntimeVersion) {
throw new Error('lts flag is not compatible with runtime version parameter');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this error is worth keeping, but if (lts && ampRuntimeVersion) should be replaced with if (lts && rtv).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Added.

`Could not download runtime version from ${ampUrlPrefix}. Falling back to ${AMP_CACHE_HOST}`
);
ampRuntimeData = await fetchLatestRuntimeData_({config, AMP_CACHE_HOST, lts}, versionKey);
} else if (versionKey) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you want to store bad results? If not:
} else if (ampRuntimeData.version && versionKey) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Collaborator Author

@sebastianbenz sebastianbenz left a comment

Choose a reason for hiding this comment

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

@mdmower - thanks for the review. PTAL


function calculateHost({ampUrlPrefix = AMP_CACHE_HOST, ampRuntimeVersion, lts, rtv = false}) {
if (lts && ampRuntimeVersion) {
throw new Error('lts flag is not compatible with runtime version parameter');
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Added.

`Could not download runtime version from ${ampUrlPrefix}. Falling back to ${AMP_CACHE_HOST}`
);
ampRuntimeData = await fetchLatestRuntimeData_({config, AMP_CACHE_HOST, lts}, versionKey);
} else if (versionKey) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

@sebastianbenz sebastianbenz requested a review from mdmower May 18, 2020 11:57
@sebastianbenz sebastianbenz merged commit 3a6534d into master May 20, 2020
@sebastianbenz sebastianbenz deleted the fix-lts branch May 20, 2020 14:58
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.

3 participants