fix DAEMON_SLEEP_INTERVAL not being defined when used

enforce minimum 60 sec spawn/sleep interval in update processes
This commit is contained in:
Andrew Dolgov 2017-05-06 10:54:14 +03:00
parent e6c886bf66
commit 4fd0790804
4 changed files with 16 additions and 7 deletions

View File

@ -1,9 +1,4 @@
<?php <?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 { class RSSUtils {
static function calculate_article_hash($article, $pluginhost) { static function calculate_article_hash($article, $pluginhost) {
$tmp = ""; $tmp = "";

View File

@ -53,6 +53,12 @@
// How many seconds to wait for initial response from website when // How many seconds to wait for initial response from website when
// fetching files from remote sites // 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") { if (DB_TYPE == "pgsql") {
define('SUBSTRING_FOR_DATE', 'SUBSTRING_FOR_DATE'); define('SUBSTRING_FOR_DATE', 'SUBSTRING_FOR_DATE');
} else { } else {

View File

@ -181,8 +181,12 @@
$log = isset($options['log']) ? '--log '.$options['log'] : ''; $log = isset($options['log']) ? '--log '.$options['log'] : '';
passthru(PHP_EXECUTABLE . " " . $argv[0] ." --daemon-loop $quiet $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);
} }
} }

View File

@ -166,6 +166,10 @@
$spawn_interval = SPAWN_INTERVAL; $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"])) { if (isset($options["log"])) {
_debug("Logging to " . $options["log"]); _debug("Logging to " . $options["log"]);
define('LOGFILE', $options["log"]); define('LOGFILE', $options["log"]);