Skip to content

Commit

Permalink
Revert "Introduce AMP Live List Cache Busting (ampproject#25295)" (am…
Browse files Browse the repository at this point in the history
…pproject#25898)

This reverts commit 0d52ea2.
  • Loading branch information
caroqliu authored and Micajuine Ho committed Dec 27, 2019
1 parent 6478f82 commit 5ea3415
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 33 deletions.
2 changes: 0 additions & 2 deletions build-system/test-configs/dep-check-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,6 @@ exports.rules = [
'src/service/origin-experiments-impl.js',
'extensions/amp-script/0.1/amp-script.js->' +
'src/service/origin-experiments-impl.js',
'extensions/amp-live-list/0.1/live-list-manager.js->' +
'src/service/origin-experiments-impl.js',
// For action macros.
'extensions/amp-action-macro/0.1/amp-action-macro.js->' +
'src/service/action-impl.js',
Expand Down
37 changes: 6 additions & 31 deletions extensions/amp-live-list/0.1/live-list-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,10 @@

import {Poller} from './poller';
import {Services} from '../../../src/services';
import {addParamsToUrl} from '../../../src/url';
import {dict} from '../../../src/utils/object';
import {addParamToUrl} from '../../../src/url';
import {fetchDocument} from '../../../src/document-fetcher';
import {getMode} from '../../../src/mode';
import {getServicePromiseForDoc} from '../../../src/service';
import {
installOriginExperimentsForDoc,
originExperimentsForDoc,
} from '../../../src/service/origin-experiments-impl';
import {startsWith} from '../../../src/string';
import {toArray} from '../../../src/types';
import {userAssert} from '../../../src/log';
Expand Down Expand Up @@ -82,9 +77,6 @@ export class LiveListManager {
/** @private @const {boolean} */
this.isTransformed_ = isDocTransformed(ampdoc.getRootNode());

/** @private {?boolean} */
this.enrolledInAppendRandomExperiment_ = null;

// Only start polling when doc is ready and when the doc is visible.
this.whenDocReady_().then(() => {
// Switch out the poller interval if we can find a lower one and
Expand Down Expand Up @@ -155,17 +147,11 @@ export class LiveListManager {
fetchDocument_() {
let url = this.url_;
if (this.latestUpdateTime_ > 0) {
const parameters = this.enrolledInAppendRandomExperiment_
? dict({
'amp_latest_update_time': String(this.latestUpdateTime_),
// AMP Caches do not always evict entries from their caches.
// This experiment adds a random identifier to reduce cache hits for enrolled documents.
'amp_random': String(Math.random()),
})
: dict({
'amp_latest_update_time': String(this.latestUpdateTime_),
});
url = addParamsToUrl(url, parameters);
url = addParamToUrl(
url,
'amp_latest_update_time',
String(this.latestUpdateTime_)
);
}

if (this.isTransformed_) {
Expand Down Expand Up @@ -293,17 +279,6 @@ export class LiveListManager {
// Polling may not be started yet if no live lists were registered by
// doc ready in LiveListManager's constructor.
if (liveList.isEnabled() && this.poller_ && this.ampdoc.isVisible()) {
if (this.enrolledInAppendRandomExperiment_ === null) {
// Origin Trial for cache busting requests for `amp-live-list`.
installOriginExperimentsForDoc(this.ampdoc);
originExperimentsForDoc(liveList.element)
.getExperiments()
.then(
trials =>
(this.enrolledInAppendRandomExperiment_ =
trials && trials.includes('amp-live-list-random'))
);
}
this.poller_.start();
}
}
Expand Down

0 comments on commit 5ea3415

Please sign in to comment.