Skip to content

Commit

Permalink
only store a certain percentage of discopane collections (bug 645180)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Balogh committed Apr 14, 2011
1 parent b52d4a0 commit 8a25ea1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/discovery/views.py
Expand Up @@ -13,6 +13,7 @@

import commonware.log
import jingo
import waffle

import amo
import amo.utils
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions 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;

0 comments on commit 8a25ea1

Please sign in to comment.