daemon: show feeds/minute stats

This commit is contained in:
Andrew Dolgov 2013-03-30 16:23:34 +04:00
parent 17e74b21cf
commit 8292d05b7c
2 changed files with 12 additions and 1 deletions

View File

@ -147,6 +147,8 @@
expire_cached_files($debug);
expire_lock_files($debug);
$nf = 0;
// For each feed, we call the feed update function.
foreach ($feeds_to_update as $feed) {
if($debug) _debug("Base feed: $feed");
@ -167,6 +169,7 @@
while ($tline = db_fetch_assoc($tmp_result)) {
if($debug) _debug(" => " . $tline["last_updated"] . ", " . $tline["id"]);
update_rss_feed($link, $tline["id"], true);
++$nf;
}
}
}
@ -176,6 +179,8 @@
// Send feed digests by email if needed.
send_headlines_digests($link, $debug);
return $nf;
} // function update_daemon_common
// ignore_daemon is not used

View File

@ -246,10 +246,12 @@
// Call to the feed batch update function
// or regenerate feedbrowser cache
$nf = 0;
if (rand(0,100) > 30) {
_debug("Waiting before update..");
sleep(rand(5,15));
update_daemon_common($link);
$nf = update_daemon_common($link);
} else {
$count = update_feedbrowser_cache($link);
_debug("Feedbrowser updated, $count feeds processed.");
@ -266,6 +268,10 @@
_debug("Elapsed time: " . (time() - $start_timestamp) . " second(s)");
if ($nf > 0) {
_debug("Feeds processed: $nf; feeds/minute: " . sprintf("%.2d", $nf/((time()-$start_timestamp)/60)));
}
db_close($link);
// We are in a fork.