From aea0cbbad1a9115b794c9af8fbb44b42115a9cb9 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 21 Sep 2020 12:35:37 +0200 Subject: Images::Vote: Remove the 90% vote count limit This is a bit of an experiment. Performance seems to be alright so far, so let's see if we can bump it up a bit. Downside is that people who've on voted almost all may sporadically get no more new images. A fair trade-off, for now. If performance allows I could add a 'just get all non-voted images and order by random()' fallback. --- lib/VNWeb/Images/Vote.pm | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib/VNWeb/Images/Vote.pm b/lib/VNWeb/Images/Vote.pm index e8a8b2f1..5d5c747e 100644 --- a/lib/VNWeb/Images/Vote.pm +++ b/lib/VNWeb/Images/Vote.pm @@ -23,18 +23,6 @@ elm_api Images => $SEND, { excl_voted => { anybool => 1 } }, sub { state $stats = tuwf->dbRowi('SELECT COUNT(*) as total, COUNT(*) FILTER (WHERE c_weight > 0) AS referenced FROM images'); - # Return an empty set when the user has voted on >90% of the (referenced) images. - # Limiting the number of images a user can vote on has two effects: - # - When the user has voted on everything, they'd be able to immediately - # vote on newly added images, meaning they can be used to influence votes - # from multiple accounts. - # - When a user has voted on a lot of images, the algorithm to select new - # images to vote on will become too slow (need to sample everything to - # find an unvoted image) or may randomly not return images (depending on - # the initial table sample). - # (Note: c_imgvotes also counts votes on unreferenced images, so this limit may be a little too strict) - return elm_ImageResult [] if $data->{excl_voted} && my_votes() > $stats->{referenced}*0.90; - # Performing a proper weighted sampling on the entire images table is way # too slow, so we do a TABLESAMPLE to first randomly select a number of # rows and then get a weighted sampling from that. The TABLESAMPLE fraction -- cgit v1.2.3