From: Andrew Dolgov Date: Wed, 9 Oct 2013 12:58:31 +0000 (+0400) Subject: add experimental hack to speed up ccache category calculation X-Git-Tag: 1.11~43 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=b66be03a4865b50efeddfce00cc45b7b7c9692ef;p=tt-rss.git add experimental hack to speed up ccache category calculation --- diff --git a/include/ccache.php b/include/ccache.php index d89b9efe..406dec81 100644 --- a/include/ccache.php +++ b/include/ccache.php @@ -92,7 +92,7 @@ } function ccache_update($feed_id, $owner_uid, $is_cat = false, - $update_pcat = true) { + $update_pcat = true, $pcat_fast = false) { if (!is_numeric($feed_id)) return; @@ -127,11 +127,13 @@ /* Recalculate counters for child feeds */ - $result = db_query("SELECT id FROM ttrss_feeds + if (!$pcat_fast) { + $result = db_query("SELECT id FROM ttrss_feeds WHERE owner_uid = '$owner_uid' AND $cat_qpart"); - while ($line = db_fetch_assoc($result)) { - ccache_update($line["id"], $owner_uid, false, false); + while ($line = db_fetch_assoc($result)) { + ccache_update($line["id"], $owner_uid, false, false); + } } $result = db_query("SELECT SUM(value) AS sv @@ -177,7 +179,7 @@ $cat_id = (int) db_fetch_result($result, 0, "cat_id"); - ccache_update($cat_id, $owner_uid, true); + ccache_update($cat_id, $owner_uid, true, true, true); } }