From 02008cb19ac99727889cca05c7eddfbeef30d684 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 23 Jan 2008 10:19:36 +0100 Subject: add multiprocess update daemon --- functions.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'functions.php') diff --git a/functions.php b/functions.php index 919cd926c..9bd98795b 100644 --- a/functions.php +++ b/functions.php @@ -468,12 +468,19 @@ _debug("update_rss_feed: start"); } - $result = db_query($link, "SELECT id,update_interval,auth_login,auth_pass,cache_images - FROM ttrss_feeds WHERE id = '$feed'"); + if (DB_TYPE == "pgsql") { + $updstart_thresh_qpart = "(ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started >= NOW() - INTERVAL '120 seconds')"; + } else { + $updstart_thresh_qpart = "(ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started >= DATE_SUB(NOW(), INTERVAL 120 SECOND))"; + } + + $result = db_query($link, "SELECT id,update_interval,auth_login, + auth_pass,cache_images + FROM ttrss_feeds WHERE id = '$feed' AND $updstart_thresh_qpart"); if (db_num_rows($result) == 0) { if (defined('DAEMON_EXTENDED_DEBUG') || $_GET['xdebug']) { - _debug("update_rss_feed: feed $feed [$feed_url] NOT FOUND"); + _debug("update_rss_feed: feed $feed [$feed_url] NOT FOUND/SKIPPED"); } return; } -- cgit v1.2.3