X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=update_daemon2.php;h=c8534af06c7db56327a099010f28d597440126f3;hb=8292d05b7c9723bc91ccdf92f6acc5e46f58ce6c;hp=1b9e57638eecfafe2b55858b5bbdb44d81db9001;hpb=cd9c29de806f1ba3d82853023c15792860f03c26;p=tt-rss.git diff --git a/update_daemon2.php b/update_daemon2.php index 1b9e5763..c8534af0 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -1,12 +1,10 @@ -#!/usr/bin/php +#!/usr/bin/env php 50) { - update_daemon_common($link); + $nf = 0; + + if (rand(0,100) > 30) { + _debug("Waiting before update.."); + sleep(rand(5,15)); + $nf = update_daemon_common($link); } else { $count = update_feedbrowser_cache($link); - _debug("Finished, $count feeds processed."); + _debug("Feedbrowser updated, $count feeds processed."); + + purge_orphans($link, true); + + $rc = cleanup_tags($link, 14, 50000); + + _debug("Cleaned $rc cached tags."); + + global $pluginhost; + $pluginhost->run_hooks($pluginhost::HOOK_UPDATE_TASK, "hook_update_task", $op); } _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. // We wait a little before exiting to avoid to be faster than our parent process. sleep(1); + + unlink(LOCK_DIRECTORY . "/$lock_filename"); + // We exit in order to avoid fork bombing. exit(0); } - - // We wait a little time before the next fork, in order to let the first fork - // mark the feeds it update : - sleep(1); } $last_checkpoint = time(); }