Commit Graph

5 Commits

Author SHA1 Message Date
xiongchiamiov
6ef290a1cf Userpage: fix top listings for comments
If you go to a userpage and sort by top (in either the overview or comments
tabs), and restrict the time range to anything other than "all time", no
comments will be shown.

The data in these listings is built from functions in `lib/db/queries.py`
(specifically from `get_comments()` down).  This ends up trying to pull the
query results from permacache (in `CachedResults.fetch_multi()`), defaulting to
an empty list if no cache entry is found.

Now, the cache entry is supposed to be populated periodically by a cronjob that
calls `scripts/compute_time_listings`.  This script (and its Python helpers in
`lib/mr_top.py` and `lib/mr_tools/`) generates a dump of data from Postgresql,
then reads through that and builds up entries to insert into the cache.  As
with many scripts of this sort, it expects to get in some bad data, and so
performs some basic sanity checks.

The problem is that the sanity checks have been throwing out all comments.
With no new comments, there's nothing new to put into the cache!

The root of this was a refactoring in reddit/reddit@3511b08 that combined
several different scripts that were doing similar things.  Unfortunately, we
ended up requiring the `url` field on comments, which doesn't exist because,
well, comments aren't links.

Now we have two sets of fields that we expect to get, one for comments and one
for links, and all is good.

We also now have a one-line summary of processed/skipped entries printed out,
which will help to make a problem like this more obvious in the future.
2015-04-30 15:53:33 -07:00
Neil Williams
af09fa8dee Update license headers to 2015.
The highlight of each year for me.
2015-01-08 13:35:03 -08:00
umbrae
c0bff7498b Support 'all' in compute_time_listings 2014-07-17 13:03:13 -07:00
Chad Birch
7b24dacd77 compute_time_listings MINID query: order by date 2014-02-26 11:44:08 -08:00
Neil Williams
3511b08110 Combine and generalize the time listing precomputer scripts.
Previously, the subreddit/domain and account precomputers were separate.
This merges the two and improves their portability in the process.
Because of the increased portability, the precomputer can now be added
to the install script by default.
2014-02-13 13:50:52 -08:00