when auto disabling feeds based on DAEMON_UNSUCCESSFUL_DAYS_LIMIT only consider feeds with recent attempts to update (to prevent clashes with not recently logged users, etc)

This commit is contained in:
Andrew Dolgov 2020-10-01 15:59:40 +03:00
parent 38a7a1da88
commit 4ea407f613
1 changed files with 4 additions and 3 deletions

View File

@ -1592,9 +1592,9 @@ class RSSUtils {
$days = (int) DAEMON_UNSUCCESSFUL_DAYS_LIMIT;
if (DB_TYPE == "pgsql") {
$interval_query = "last_successful_update < NOW() - INTERVAL '$days days'";
$interval_query = "last_successful_update < NOW() - INTERVAL '$days days' AND last_updated > NOW() - INTERVAL '1 days'";
} else if (DB_TYPE == "mysql") {
$interval_query = "last_successful_update < DATE_SUB(NOW(), INTERVAL $days DAY)";
$interval_query = "last_successful_update < DATE_SUB(NOW(), INTERVAL $days DAY) AND last_updated > DATE_SUB(NOW(), INTERVAL 1 DAY)";
}
$sth = $pdo->prepare("SELECT id, title, owner_uid
@ -1608,7 +1608,8 @@ class RSSUtils {
sprintf("Auto disabling feed %d (%s, UID: %d) because it failed to update for %d days.",
$row["id"], clean($row["title"]), $row["owner_uid"], DAEMON_UNSUCCESSFUL_DAYS_LIMIT));
Debug::log(sprintf("Auto-disabling feed %d (failed to update for %d days).", $row["id"], DAEMON_UNSUCCESSFUL_DAYS_LIMIT));
Debug::log(sprintf("Auto-disabling feed %d (%s) (failed to update for %d days).", $row["id"],
clean($row["title"]), DAEMON_UNSUCCESSFUL_DAYS_LIMIT));
}
$sth = $pdo->prepare("UPDATE ttrss_feeds SET update_interval = -1 WHERE