diff options
authorYorhel <>2020-09-21 12:35:37 +0200
committerYorhel <>2020-09-21 12:35:39 +0200
commitaea0cbbad1a9115b794c9af8fbb44b42115a9cb9 (patch)
parent29d49ca2c7160a898e5e0a40baecd3766bdf99d6 (diff)
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.
1 files changed, 0 insertions, 12 deletions
diff --git a/lib/VNWeb/Images/ b/lib/VNWeb/Images/
index e8a8b2f1..5d5c747e 100644
--- a/lib/VNWeb/Images/
+++ b/lib/VNWeb/Images/
@@ -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