about summary refs log tree commit diff
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2024-08-24T12·06+0200
committerProfpatsch <mail@profpatsch.de>2024-09-13T11·13+0000
commit95640e7be49cc533bef2e182b80a1f8d1a5dcb35 (patch)
tree554c433eaedc2c7e087c5e5a765899e7a324469c
parent9e2ecf9101e39a6bcf0d7186546f3dc565dc1d0d (diff)
fix(users/Profpatsch/whatcd-resolver): prefer downloaded torrents r/8678
I changed the seeding weight, so now it would not show already
downloaded torrents, prompting me to fetch stuff that I already have
in new qualities. Obviously, that’s not the best idea.

Kinda surprised it’s this easy to fix heh.

Change-Id: I6bbf325672a91d794d144c006ccf3d702a581bce
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12330
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
-rw-r--r--users/Profpatsch/whatcd-resolver/src/Redacted.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/users/Profpatsch/whatcd-resolver/src/Redacted.hs b/users/Profpatsch/whatcd-resolver/src/Redacted.hs
index cb9d87a279e2..692a1a359a7f 100644
--- a/users/Profpatsch/whatcd-resolver/src/Redacted.hs
+++ b/users/Profpatsch/whatcd-resolver/src/Redacted.hs
@@ -413,7 +413,11 @@ getBestTorrents opts = do
           -- filter by artist id
           AND
           (?::bool OR (to_jsonb(?::int) <@ (jsonb_path_query_array(full_json_result, '$.artists[*].id'))))
-        ORDER BY torrent_group, seeding_weight DESC
+        ORDER BY
+          torrent_group,
+          -- prefer torrents which we already downloaded
+          torrent_file,
+          seeding_weight DESC
       )
       SELECT
         tg.group_id,