mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-18 02:11:30 +00:00
getAllCounters: add rate limit (5 sec)
This commit is contained in:
@@ -2199,26 +2199,28 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAllCounters($link, $omode = "flc", $active_feed = false) {
|
function getAllCounters($link, $omode = "flc", $active_feed = false) {
|
||||||
/* getLabelCounters($link);
|
|
||||||
getFeedCounters($link);
|
|
||||||
getTagCounters($link);
|
|
||||||
getGlobalCounters($link);
|
|
||||||
if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
|
||||||
getCategoryCounters($link);
|
|
||||||
} */
|
|
||||||
|
|
||||||
if (!$omode) $omode = "flc";
|
/* getting all counters is a resource intensive operation, so we
|
||||||
|
* rate limit it a little bit */
|
||||||
|
|
||||||
getGlobalCounters($link);
|
if (time() - $_SESSION["get_all_counters_stamp"] > 5) {
|
||||||
|
|
||||||
if (strchr($omode, "l")) getLabelCounters($link);
|
if (!$omode) $omode = "flc";
|
||||||
if (strchr($omode, "f")) getFeedCounters($link, SMART_RPC_COUNTERS, $active_feed);
|
|
||||||
if (strchr($omode, "t")) getTagCounters($link);
|
getGlobalCounters($link);
|
||||||
if (strchr($omode, "c")) {
|
|
||||||
if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
if (strchr($omode, "l")) getLabelCounters($link);
|
||||||
getCategoryCounters($link);
|
if (strchr($omode, "f")) getFeedCounters($link, SMART_RPC_COUNTERS, $active_feed);
|
||||||
|
if (strchr($omode, "t")) getTagCounters($link);
|
||||||
|
if (strchr($omode, "c")) {
|
||||||
|
if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
||||||
|
getCategoryCounters($link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$_SESSION["get_all_counters_stamp"] = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCategoryCounters($link) {
|
function getCategoryCounters($link) {
|
||||||
|
|||||||
Reference in New Issue
Block a user