From 8a25ea17c7bcfbcd913cdbaf0fe1bcfb9610b3a2 Mon Sep 17 00:00:00 2001 From: Jeff Balogh Date: Wed, 13 Apr 2011 17:22:52 -0700 Subject: [PATCH] only store a certain percentage of discopane collections (bug 645180) --- apps/discovery/views.py | 6 ++++++ migrations/179-more-waffles.sql | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 migrations/179-more-waffles.sql diff --git a/apps/discovery/views.py b/apps/discovery/views.py index 74c36d67e3d..95b8de8f7a8 100644 --- a/apps/discovery/views.py +++ b/apps/discovery/views.py @@ -13,6 +13,7 @@ import commonware.log import jingo +import waffle import amo import amo.utils @@ -148,6 +149,11 @@ def recommendations(request, version, platform, limit=9): recs = _recommendations(request, version, platform, limit, index, ids, recs) + # We're only storing a percentage of the collections we see because the db + # can't keep up with 100%. + if not waffle.sample_is_active('disco-pane-store-collections'): + return recs + # Users have a token2 if they've been here before. The token matches # addon_index in their SyncedCollection. if 'token2' in POST: diff --git a/migrations/179-more-waffles.sql b/migrations/179-more-waffles.sql new file mode 100644 index 00000000000..613a25e8638 --- /dev/null +++ b/migrations/179-more-waffles.sql @@ -0,0 +1,5 @@ +CREATE TABLE `waffle_sample` ( + `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, + `name` varchar(100) NOT NULL UNIQUE, + `percent` numeric(4, 1) NOT NULL +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;