Default period is 10 seconds

This commit is contained in:
Romain Neutron
2012-03-30 14:34:40 +02:00
parent 64b80b5d45
commit 46f1dba42a

View File

@@ -220,6 +220,7 @@ abstract class task_abstract
{ {
return $this->crash_counter; return $this->crash_counter;
} }
public function increment_crash_counter() public function increment_crash_counter()
{ {
$conn = connection::getPDOConnection(); $conn = connection::getPDOConnection();
@@ -247,7 +248,7 @@ abstract class task_abstract
return $this->completed_percentage; return $this->completed_percentage;
} }
protected $period = 60; protected $period = 10;
protected $taskid = NULL; protected $taskid = NULL;
protected $system = ''; // "DARWIN", "WINDOWS" , "LINUX"... protected $system = ''; // "DARWIN", "WINDOWS" , "LINUX"...
protected $argt = array( protected $argt = array(
@@ -556,9 +557,7 @@ abstract class task_abstract
protected function load_settings(SimpleXMLElement $sx_task_settings) protected function load_settings(SimpleXMLElement $sx_task_settings)
{ {
$this->period = (int) $sx_task_settings->period; $this->period = max(10, min(3600, (int) $sx_task_settings->period));
if ($this->period <= 0 || $this->period >= 60 * 60)
$this->period = 60;
$this->maxrecs = (int) $sx_task_settings->maxrecs; $this->maxrecs = (int) $sx_task_settings->maxrecs;
if ($sx_task_settings->maxrecs < 10 || $sx_task_settings->maxrecs > 1000) if ($sx_task_settings->maxrecs < 10 || $sx_task_settings->maxrecs > 1000)
@@ -702,7 +701,7 @@ abstract class task_abstract
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return $this; return $this;