fix updater never scheduling feeds for update if they never been updated before while having default update interval set

This commit is contained in:
Andrew Dolgov 2020-09-22 20:33:51 +03:00
parent 8fb2baecdc
commit 05744bb474
2 changed files with 14 additions and 22 deletions

View File

@ -435,9 +435,8 @@ class RPC extends Handler_Protected {
) OR ( ) OR (
ttrss_feeds.update_interval > 0 ttrss_feeds.update_interval > 0
AND ttrss_feeds.last_updated < NOW() - CAST((ttrss_feeds.update_interval || ' minutes') AS INTERVAL) AND ttrss_feeds.last_updated < NOW() - CAST((ttrss_feeds.update_interval || ' minutes') AS INTERVAL)
) OR ttrss_feeds.last_updated IS NULL ) OR (
OR ( ttrss_feeds.update_interval >= 0
ttrss_feeds.update_interval > 0
AND (last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL) AND (last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL)
))"; ))";
} else { } else {
@ -447,9 +446,8 @@ class RPC extends Handler_Protected {
) OR ( ) OR (
ttrss_feeds.update_interval > 0 ttrss_feeds.update_interval > 0
AND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL ttrss_feeds.update_interval MINUTE) AND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL ttrss_feeds.update_interval MINUTE)
) OR ttrss_feeds.last_updated IS NULL ) OR (
OR ( ttrss_feeds.update_interval >= 0
ttrss_feeds.update_interval > 0
AND (last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL) AND (last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL)
))"; ))";
} }

View File

@ -52,37 +52,31 @@ class RSSUtils {
$update_limit_qpart = "AND (( $update_limit_qpart = "AND ((
ttrss_feeds.update_interval = 0 ttrss_feeds.update_interval = 0
AND ttrss_user_prefs.value != '-1' AND ttrss_user_prefs.value != '-1'
AND ttrss_feeds.last_updated < NOW() - CAST((ttrss_user_prefs.value || ' minutes') AS INTERVAL) AND last_updated < NOW() - CAST((ttrss_user_prefs.value || ' minutes') AS INTERVAL)
) OR ( ) OR (
ttrss_feeds.update_interval > 0 ttrss_feeds.update_interval > 0
AND ttrss_feeds.last_updated < NOW() - CAST((ttrss_feeds.update_interval || ' minutes') AS INTERVAL) AND last_updated < NOW() - CAST((ttrss_feeds.update_interval || ' minutes') AS INTERVAL)
) OR (ttrss_feeds.last_updated IS NULL ) OR ((last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL)
AND ttrss_feeds.update_interval > 0 AND ttrss_feeds.update_interval >= 0
AND ttrss_user_prefs.value != '-1')
OR (last_updated = '1970-01-01 00:00:00'
AND ttrss_feeds.update_interval > 0
AND ttrss_user_prefs.value != '-1'))"; AND ttrss_user_prefs.value != '-1'))";
} else { } else {
$update_limit_qpart = "AND (( $update_limit_qpart = "AND ((
ttrss_feeds.update_interval = 0 ttrss_feeds.update_interval = 0
AND ttrss_user_prefs.value != '-1' AND ttrss_user_prefs.value != '-1'
AND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL CONVERT(ttrss_user_prefs.value, SIGNED INTEGER) MINUTE) AND last_updated < DATE_SUB(NOW(), INTERVAL CONVERT(ttrss_user_prefs.value, SIGNED INTEGER) MINUTE)
) OR ( ) OR (
ttrss_feeds.update_interval > 0 ttrss_feeds.update_interval > 0
AND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL ttrss_feeds.update_interval MINUTE) AND last_updated < DATE_SUB(NOW(), INTERVAL ttrss_feeds.update_interval MINUTE)
) OR (ttrss_feeds.last_updated IS NULL ) OR ((last_updated = '1970-01-01 00:00:00' OR last_updated IS NULL)
AND ttrss_feeds.update_interval > 0 AND ttrss_feeds.update_interval >= 0
AND ttrss_user_prefs.value != '-1')
OR (last_updated = '1970-01-01 00:00:00'
AND ttrss_feeds.update_interval > 0
AND ttrss_user_prefs.value != '-1'))"; AND ttrss_user_prefs.value != '-1'))";
} }
// Test if feed is currently being updated by another process. // Test if feed is currently being updated by another process.
if (DB_TYPE == "pgsql") { if (DB_TYPE == "pgsql") {
$updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < NOW() - INTERVAL '10 minutes')"; $updstart_thresh_qpart = "AND (last_update_started IS NULL OR last_update_started < NOW() - INTERVAL '10 minutes')";
} else { } else {
$updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < DATE_SUB(NOW(), INTERVAL 10 MINUTE))"; $updstart_thresh_qpart = "AND (last_update_started IS NULL OR last_update_started < DATE_SUB(NOW(), INTERVAL 10 MINUTE))";
} }
$query_limit = $limit ? sprintf("LIMIT %d", $limit) : ""; $query_limit = $limit ? sprintf("LIMIT %d", $limit) : "";