Commit Graph

1623 Commits

Author SHA1 Message Date
maxwellhansen
ca39abfa9b upload_static: Use dictionary comprehension for readability. 2012-08-13 10:21:37 -07:00
Neil Williams
c148165845 Clean up miscellanea in r2.lib.
Remove some unused files and move some tests to the test tree.
2012-08-13 10:21:37 -07:00
Neil Williams
d896b9a71f ZooKeeper: Make reduction of data optional in LiveList.get().
If we need the raw list of objects so that we can know what objects can
be deleted etc. then we'll need to disable the reduction.
2012-08-08 23:33:17 -07:00
Neil Williams
cf527d15cf ZooKeeper: Add pull model for LiveList.
The base LiveList set up is similar to LiveConfig; it sets a watch and
will get notified by ZooKeeper when the data changes. Sometimes we don't
need data very frequently, if at all, and would rather eschew the watch
for a pull based model (asking ZK for the data only when needed.) This
is particularly helpful if we're doing write-only changes to a
datastructure read only in one place (such as a queue processor).
2012-08-08 23:33:17 -07:00
Neil Williams
b75f6f26b6 Refactor IP-range searching code for better reusability.
Useful for util scripts etc.
2012-08-08 23:33:17 -07:00
Max Goodman
768663b032 Abort Makefile if Makefile.py fails. 2012-08-08 13:47:03 -07:00
Max Goodman
705e1bb123 Fix js.py module loading to use PluginLoader.
Fixes issue where js.py wasn't initializing Plugins with an entry_point
argument after the entry_point property was added.
2012-08-08 13:47:03 -07:00
Max Goodman
f19bb7c4f4 Load all plugins if None is passed to PluginLoader. 2012-08-08 13:47:03 -07:00
Max Goodman
bd16af84a4 Add plugin repo versions to the health list. 2012-08-08 13:47:03 -07:00
Max Goodman
fd13f2100a Add entry point property to plugin instances. 2012-08-08 13:47:03 -07:00
Max Goodman
25d96f1fc8 Remove unused comScore code. 2012-08-08 13:47:03 -07:00
Max Goodman
26d6b780dc Remove a few old static mini sites.
Also, update Socialite links to direct users to AMO.
2012-08-08 13:47:03 -07:00
Max Goodman
dd937cf73a My coworkers are silly. 2012-08-08 13:47:03 -07:00
Max Goodman
355a06d533 Add optional default value to NamedGlobals. 2012-08-08 13:47:03 -07:00
Max Goodman
bd42357847 Add NamedGlobals for storing long-lived unique data blobs. 2012-08-08 13:47:03 -07:00
Max Goodman
a186e5e7e9 Copy Modernizr's more robust sessionStorage feature detection. 2012-08-08 13:47:02 -07:00
Max Goodman
e5853f189d Re-reshuffle JS utils order. 2012-08-08 13:47:02 -07:00
Max Goodman
02eb461cfd Whitespace. 2012-08-08 13:47:02 -07:00
Max Goodman
272a1d86be Add icon for Opera speed dial. 2012-08-08 13:47:02 -07:00
Max Goodman
87be2c0a6c Remove hanging r.login.currentOrigin after refactor.
Original refactor in 482e8644d8
2012-08-08 13:47:02 -07:00
Keith Mitchell
0cf4f67642 Fix db_sort KeyError 2012-08-08 10:44:42 -07:00
shlurbee
65998674c8 Make promotion summary emails read from PromoCampaign things
These were still reading from the campaigns link attribute, which would have
caused them to fail when we stop dual writing to the link attribute.
2012-08-08 10:44:35 -07:00
Keith Mitchell
987be0d961 Replace reference to #subreddit with /r/subreddit 2012-08-07 10:02:04 -07:00
Neil Williams
ced53a257a Move IP-based throttling to ZooKeeper.
This buys us two things: one fewer memcache roundtrip per request to
determine if the IP is throttled or not, and the ability to use CIDR for
specifying blocks.

Google's ipaddress-py library as currently being modified (6f231f50aace)
for inclusion in the Python stdlib is included here to help us
manipulate CIDR ranges etc.
2012-08-06 15:30:39 -07:00
Neil Williams
34e57011b6 install-reddit: Make sure to start Cassandra after install.
The reddit PPA version of Cassandra no longer auto-starts on install
because that was really obnoxious in production. We'll have to make
sure to start the service after installing it.
2012-08-06 11:18:35 -07:00
Neil Williams
5887e0898e install-reddit: Use netcat to determine if services are up.
This is more robust than the previous method which slept for 30 seconds
and ended up being simultaneously optimistic and pessimistic.
2012-08-06 11:18:35 -07:00
Neil Williams
4a4543b38b Move frontpage_dart option into new live config.
Enabling home page roadblocks has never been so easy!
2012-08-02 17:14:36 -07:00
Logan Hanks
ccbdf5c7ea Make ConfigValue.bool accept True, False, and None values. 2012-08-02 17:14:36 -07:00
Neil Williams
4a8893c838 Increase strictness of ConfigValue.bool.
Previously, it would treat anything that wasn't (case insensitively)
equal to "true" as False. The new configparser will ensure that the
value is either "true" or "false" and not "slkdjfljksdf", reducing the
risk of accidental False by typo.
2012-08-02 17:14:36 -07:00
Neil Williams
f495dad2a8 Add ZooKeeper-based dynamic configuration system.
The dynamic configuration system has two components: the app, which
reads, and the writer script. The latter is meant for use by humans, and
converts a [live_config] section of the INI file into JSON for storage
in ZooKeeper. The app will read this data on startup and place a watch
on the node to be notified, by ZooKeeper, of changes. This means that
running the writer script with new data will automatically propagate the
changes to every app very quickly, without restart.

The writer script relies on a human-entered password to authenticate
with ZooKeeper. The reddit app uses a different set of credentials
(specified in the INI file) to obtain read-only access to the
configuration data.

Also adds a new "live_config" spec to reddit and plugins. This spec is
parsed at write-time only and the parsed values are stored as JSON in
ZooKeeper.
2012-08-02 17:14:36 -07:00
Neil Williams
2c5021bb11 Split plugin loading into two phases.
The first phase loads the entry points and instantiates plugin objects.
This phase is useful for inspecting plugin metadata without having a
full environment configured (routing etc.). This phase is moved earlier
in the init process, to the first moment after the configuration has
been parsed.

The second phase does the heavy work of making individual plugins inject
themselves into the otherwise ready reddit environment. This phase stays
where plugin loading took place before (after global setup).
2012-08-02 17:14:36 -07:00
Neil Williams
0b09f25b28 Add basic support for ZooKeeper via Kazoo.
At this point, we can connect and pass authentication credentials!
2012-08-02 17:14:36 -07:00
Max Goodman
d77c53fa44 Add class to the top bar random button for breadcrumb tracking. 2012-08-02 17:12:57 -07:00
Neil Williams
0a70249658 Make link domain easier to read on spammed links. 2012-08-02 17:12:33 -07:00
Keith Mitchell
59c22e8bf3 Sort duplicates by number of comments 2012-08-02 14:19:48 -07:00
Keith Mitchell
7cf4926311 Update comment by cleaning code 2012-08-02 14:19:43 -07:00
Keith Mitchell
5e3dccd381 Don't set results to 0 when cleaning up a query 2012-08-02 14:19:37 -07:00
shlurbee
d7000c283a Include campaign id in duplicate bid error handling
Uses both transaction id and campaign id to uniquely identify a bid. This
fixes a bug where querying for one bid in some cases caused a multiple rows
returned exception - a side effect of the campaign migration, which left both
old and new bids in the db.

This change also includes the campaign id when attempting to recreate a lost
bid record because... bid records are supposed to have campaign ids. I'm not
sure what was happening with the bid records that didn't.
2012-08-01 15:25:43 -07:00
shlurbee
47a6a88ca0 Fix cc date validation error
This check was raising a value error if run on the 31st against an expiration
date in a month that only had 30 days. Now we pick the 1st day of the month,
which is guaranteed to exist.

Also uses the correct timezone.
2012-08-01 15:25:40 -07:00
shlurbee
0aa9967d82 Prevent AttributeError when calling date() in edit_campaign
There have been some None object has no date() attribute errors in the logs.
Not sure how one of start/end are being set to None and not the other, but
went ahead and moved the call to date() inside the conditional that checks
whether both exist to make sure the correct error message gets set.
2012-08-01 15:25:37 -07:00
shlurbee
ead23d6a61 Raise exception on failure in make_daily_promotions
Makes get_schedule return a list of errored campaigns instead of just logging
them so they can be handled by the calling function.

Updates make_daily_promotions to first launch as many campaigns as possible,
then raise an exception with a list of errors at the end. The exception is
useful for triggering alerts.

See https://github.com/reddit/reddit-public/issues/570
2012-08-01 15:25:34 -07:00
Logan Hanks
fe13fd2114 Allow anyone to fetch a subreddit's flair. 2012-07-31 15:30:01 -07:00
Neil Williams
3457860b95 Don't count automatic subreddits against subscription limits.
When getting a list of user subreddits, we'll check if they're
subscribed to any automatic subreddits and remove them from the mix
before doing the random selection. Then they'll be added back in. This
is important to ensure that maintenance announcements aren't missed by
users because the announcement wasn't in their subset of subscriptions.

On reddit.com the automatic subreddits are /r/blog and /r/announcements.
2012-07-31 15:30:01 -07:00
Neil Williams
ab13e13170 traffic: Change top_last_month to sort by pageviews.
We generally use total pageviews more than uniques, so this is a more
meaningful metric to sort by.
2012-07-31 15:30:01 -07:00
Neil Williams
aa268840fa Apply domain shame-bans to toolbar framing.
Some evil people are using the toolbar URLs to spam their links and then
framebusting to ditch the toolbar. This patch makes it so that if the
framed URL is on a shame-banned domain, the framing will abort and
return a 404.
2012-07-30 12:28:18 -07:00
Max Goodman
482e8644d8 Fire a pixel for UI flow tracking of sub/unsubscribe.
This will allow us to collect information about how users found
subreddits that they subscribe to. We can use this information to test
the effectiveness of new ways of discovering and subscribing to
subreddits.

Specifically, when the subscribe button is clicked, for the current page
and previous page: the URL, referrer URL, and the type of UI element
clicked are sent. We'll use this to answer questions like:

 * "did clicking on gizmo A lead to users subscribing to subreddit B?"
 * "why did we see a spike in subscriptions to subreddit X today?"
2012-07-27 17:25:04 -07:00
Max Goodman
39e3a81c0a Include underscore.js. 2012-07-27 17:23:57 -07:00
Max Goodman
08eb0dacdd Make organic box sponsored link help translatable. 2012-07-27 17:23:57 -07:00
Max Goodman
eb1ccbcd2c Fix indentation. 2012-07-27 17:23:57 -07:00
Max Goodman
9fb5bf4ead » > ›. 2012-07-27 17:23:57 -07:00