summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-09-27 16:42:42 +0300
committerAndrew Dolgov <[email protected]>2020-09-27 16:42:45 +0300
commitd4d0e976dc371d6fb761d3e3713ca0f7182ebb40 (patch)
tree635a59aefe6a293e36f88b4da4088c5483876024
parent0761533d0abb2851c9f52224f64ce28fc0746acd (diff)
update-feed: exit with non-zero exit code if update_rss_feed() failed
daemon: log if per-feed update task terminated with non-zero exit code
-rwxr-xr-xclasses/rssutils.php9
-rwxr-xr-xupdate.php7
2 files changed, 13 insertions, 3 deletions
diff --git a/classes/rssutils.php b/classes/rssutils.php
index d7361b2c0..114932569 100755
--- a/classes/rssutils.php
+++ b/classes/rssutils.php
@@ -150,7 +150,8 @@ class RSSUtils {
$log = function_exists("flock") && isset($options['log']) ? '--log '.$options['log'] : '';
$log_level = isset($options['log-level']) ? '--log-level '.$options['log-level'] : '';
- passthru(PHP_EXECUTABLE . " update.php --update-feed " . $tline["id"] . " --pidlock feed-" . $tline["id"] . " $quiet $log $log_level");
+ $exit_code = 0;
+ passthru(PHP_EXECUTABLE . " update.php --update-feed " . $tline["id"] . " --pidlock feed-" . $tline["id"] . " $quiet $log $log_level", $exit_code);
/* try {
self::update_rss_feed($tline["id"], true, false);
@@ -165,7 +166,11 @@ class RSSUtils {
}
} */
- Debug::log(sprintf(" %.4f (sec)", microtime(true) - $fstarted));
+ Debug::log(sprintf(" %.4f (sec) RC=%d", microtime(true) - $fstarted, $exit_code));
+
+ if ($exit_code != 0) {
+ Logger::get()->log(sprintf("Update process for feed %d terminated with non-zero exit code: %d", $tline["id"], $exit_code));
+ }
++$nf;
}
diff --git a/update.php b/update.php
index d3ccdc236..c6af40715 100755
--- a/update.php
+++ b/update.php
@@ -260,12 +260,17 @@
if (isset($options["update-feed"])) {
try {
- RSSUtils::update_rss_feed($options["update-feed"], true);
+
+ if (!RSSUtils::update_rss_feed($options["update-feed"], true))
+ exit(100);
+
} 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());
+
+ exit(110);
}
}