summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-05-06 10:54:14 +0300
committerAndrew Dolgov <[email protected]>2017-05-06 10:54:14 +0300
commit4fd0790804191dac3247430cc3bd7053ae7d32ca (patch)
tree623a584dc90470c47231ab5ec99ca3582407c855
parente6c886bf66928d4bd496672f12b79b547747677b (diff)
fix DAEMON_SLEEP_INTERVAL not being defined when used
enforce minimum 60 sec spawn/sleep interval in update processes
-rw-r--r--classes/rssutils.php5
-rw-r--r--include/functions.php6
-rwxr-xr-xupdate.php8
-rwxr-xr-xupdate_daemon2.php4
4 files changed, 16 insertions, 7 deletions
diff --git a/classes/rssutils.php b/classes/rssutils.php
index 84d6941da..1c8846e4e 100644
--- a/classes/rssutils.php
+++ b/classes/rssutils.php
@@ -1,9 +1,4 @@
<?php
-define_default('DAEMON_UPDATE_LOGIN_LIMIT', 30);
-define_default('DAEMON_FEED_LIMIT', 500);
-define_default('DAEMON_SLEEP_INTERVAL', 120);
-define_default('_MIN_CACHE_FILE_SIZE', 1024);
-
class RSSUtils {
static function calculate_article_hash($article, $pluginhost) {
$tmp = "";
diff --git a/include/functions.php b/include/functions.php
index b448c5a9d..4801876c1 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -53,6 +53,12 @@
// How many seconds to wait for initial response from website when
// fetching files from remote sites
+ // feed updating stuff
+ define_default('DAEMON_UPDATE_LOGIN_LIMIT', 30);
+ define_default('DAEMON_FEED_LIMIT', 500);
+ define_default('DAEMON_SLEEP_INTERVAL', 120);
+ define_default('_MIN_CACHE_FILE_SIZE', 1024);
+
if (DB_TYPE == "pgsql") {
define('SUBSTRING_FOR_DATE', 'SUBSTRING_FOR_DATE');
} else {
diff --git a/update.php b/update.php
index fe2b3c572..9012d717b 100755
--- a/update.php
+++ b/update.php
@@ -181,8 +181,12 @@
$log = isset($options['log']) ? '--log '.$options['log'] : '';
passthru(PHP_EXECUTABLE . " " . $argv[0] ." --daemon-loop $quiet $log");
- _debug("Sleeping for " . DAEMON_SLEEP_INTERVAL . " seconds...");
- sleep(DAEMON_SLEEP_INTERVAL);
+
+ // let's enforce a minimum spawn interval as to not forkbomb the host
+ $spawn_interval = max(60, DAEMON_SLEEP_INTERVAL);
+
+ _debug("Sleeping for $spawn_interval seconds...");
+ sleep($spawn_interval);
}
}
diff --git a/update_daemon2.php b/update_daemon2.php
index 1e6edb337..af29ac18f 100755
--- a/update_daemon2.php
+++ b/update_daemon2.php
@@ -166,6 +166,10 @@
$spawn_interval = SPAWN_INTERVAL;
}
+ // let's enforce a minimum spawn interval as to not forkbomb the host
+ $spawn_interval = max(60, $spawn_interval);
+ _debug("Spawn interval: $spawn_interval sec");
+
if (isset($options["log"])) {
_debug("Logging to " . $options["log"]);
define('LOGFILE', $options["log"]);