summaryrefslogtreecommitdiff
path: root/update.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-09-27 15:58:13 +0300
committerAndrew Dolgov <[email protected]>2020-09-27 15:58:13 +0300
commit528b387563d05cb28bbde2fe0ce4599c62b0f02e (patch)
treee7d963099add5507d78be4c4efc09f582e3bda2d /update.php
parente993d4feb2e90600f5c896f1e3508f7f95e81c84 (diff)
update individual feed in a separate process to prevent PHP fatal errors
(for example, OOM) from stopping the entire batch this should also slightly increase memory budget for update processes
Diffstat (limited to 'update.php')
-rwxr-xr-xupdate.php24
1 files changed, 18 insertions, 6 deletions
diff --git a/update.php b/update.php
index 8b325d7bb..d3ccdc236 100755
--- a/update.php
+++ b/update.php
@@ -82,6 +82,7 @@
$longopts = array("feeds",
"daemon",
"daemon-loop",
+ "update-feed:",
"send-digests",
"task:",
"cleanup-tags",
@@ -235,8 +236,8 @@
}
if (isset($options["feeds"])) {
- RSSUtils::update_daemon_common();
- RSSUtils::housekeeping_common(true);
+ RSSUtils::update_daemon_common(DAEMON_FEED_LIMIT, $options);
+ RSSUtils::housekeeping_common();
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op);
}
@@ -244,8 +245,8 @@
if (isset($options["daemon"])) {
while (true) {
$quiet = (isset($options["quiet"])) ? "--quiet" : "";
- $log = isset($options['log']) ? '--log '.$options['log'] : '';
- $log_level = isset($options['log-level']) ? '--log-level '.$options['log-level'] : '';
+ $log = isset($options['log']) ? '--log '.$options['log'] : '';
+ $log_level = isset($options['log-level']) ? '--log-level '.$options['log-level'] : '';
passthru(PHP_EXECUTABLE . " " . $argv[0] ." --daemon-loop $quiet $log $log_level");
@@ -257,15 +258,26 @@
}
}
+ if (isset($options["update-feed"])) {
+ try {
+ RSSUtils::update_rss_feed($options["update-feed"], true);
+ } catch (PDOException $e) {
+ Debug::log(sprintf("Exception while updating feed %d: %s (%s:%d)",
+ $options["update-feed"], $e->getMessage(), $e->getFile(), $e->getLine()));
+
+ Logger::get()->log_error(E_USER_NOTICE, $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString());
+ }
+ }
+
if (isset($options["daemon-loop"])) {
if (!make_stampfile('update_daemon.stamp')) {
Debug::log("warning: unable to create stampfile\n");
}
- RSSUtils::update_daemon_common(isset($options["pidlock"]) ? 50 : DAEMON_FEED_LIMIT);
+ RSSUtils::update_daemon_common(isset($options["pidlock"]) ? 50 : DAEMON_FEED_LIMIT, $options);
if (!isset($options["pidlock"]) || $options["task"] == 0)
- RSSUtils::housekeeping_common(true);
+ RSSUtils::housekeeping_common();
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op);
}