summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-08-12 16:43:42 +0200
committerYorhel <git@yorhel.nl>2019-08-12 16:43:42 +0200
commitfbde6488c85cdffbfdffe5b7b9de4dfd6e11226f (patch)
tree231d84b0ab39d5d628ae2de92d12d6be3f1e2a1f
parent75a5812b4bca89849c59cb0bb8d94e4bc48dd01d (diff)
Multi::Wikidata: Fix fetch criteria + use date_trunc() to batch refreshes
-rw-r--r--lib/Multi/Wikidata.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Multi/Wikidata.pm b/lib/Multi/Wikidata.pm
index fea9dbb1..1681700f 100644
--- a/lib/Multi/Wikidata.pm
+++ b/lib/Multi/Wikidata.pm
@@ -34,10 +34,10 @@ sub fetch {
SELECT id
FROM wikidata
WHERE id IN(
- SELECT l_wikidata FROM producers WHERE l_wp IS NOT NULL AND NOT hidden
- UNION SELECT l_wikidata FROM staff WHERE l_wp IS NOT NULL AND NOT hidden
- UNION SELECT l_wikidata FROM vn WHERE l_wp IS NOT NULL AND NOT hidden)
- AND (lastfetch IS NULL OR lastfetch < now()-($1 * '1 second'::interval))
+ SELECT l_wikidata FROM producers WHERE l_wikidata IS NOT NULL AND NOT hidden
+ UNION SELECT l_wikidata FROM staff WHERE l_wikidata IS NOT NULL AND NOT hidden
+ UNION SELECT l_wikidata FROM vn WHERE l_wikidata IS NOT NULL AND NOT hidden)
+ AND (lastfetch IS NULL OR lastfetch < date_trunc('hour', now()-($1 * '1 second'::interval)))
ORDER BY lastfetch NULLS FIRST
LIMIT $2
}, [ $C{fetch_interval}, $C{fetch_number} ], sub {