We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit e498bc6b authored by mattl's avatar mattl

Control OpportunisticQM verbosity

parent 7fbf72f9
...@@ -4,6 +4,7 @@ class OpportunisticQMPlugin extends Plugin { ...@@ -4,6 +4,7 @@ class OpportunisticQMPlugin extends Plugin {
public $qmkey = false; public $qmkey = false;
public $secs_per_action = 1; // total seconds to run script per action public $secs_per_action = 1; // total seconds to run script per action
public $rel_to_pageload = true; // relative to pageload or queue start public $rel_to_pageload = true; // relative to pageload or queue start
public $verbosity = 1;
public function onRouterInitialized($m) public function onRouterInitialized($m)
{ {
...@@ -26,6 +27,7 @@ class OpportunisticQMPlugin extends Plugin { ...@@ -26,6 +27,7 @@ class OpportunisticQMPlugin extends Plugin {
'qmkey' => common_config('opportunisticqm', 'qmkey'), 'qmkey' => common_config('opportunisticqm', 'qmkey'),
'max_execution_time' => $this->secs_per_action, 'max_execution_time' => $this->secs_per_action,
'started_at' => $this->rel_to_pageload ? $_startTime : null, 'started_at' => $this->rel_to_pageload ? $_startTime : null,
'verbosity' => $this->verbosity,
); );
$qm = new OpportunisticQueueManager($args); $qm = new OpportunisticQueueManager($args);
$qm->runQueue(); $qm->runQueue();
......
...@@ -24,6 +24,8 @@ class OpportunisticQueueManager extends DBQueueManager ...@@ -24,6 +24,8 @@ class OpportunisticQueueManager extends DBQueueManager
protected $started_at = null; protected $started_at = null;
protected $handled_items = 0; protected $handled_items = 0;
protected $verbosity = null;
const MAXEXECTIME = 20; // typically just used for the /main/cron action, only used if php.ini max_execution_time is 0 const MAXEXECTIME = 20; // typically just used for the /main/cron action, only used if php.ini max_execution_time is 0
public function __construct(array $args=array()) { public function __construct(array $args=array()) {
...@@ -116,7 +118,7 @@ class OpportunisticQueueManager extends DBQueueManager ...@@ -116,7 +118,7 @@ class OpportunisticQueueManager extends DBQueueManager
} }
if ($this->handled_items > 0) { if ($this->handled_items > 0) {
common_debug('Opportunistic queue manager passed execution time/item handling limit without being out of work.'); common_debug('Opportunistic queue manager passed execution time/item handling limit without being out of work.');
} else { } elseif ($this->verbosity > 1) {
common_debug('Opportunistic queue manager did not have time to start on this action (max: '.$this->max_execution_time.' exceeded: '.abs(time()-$this->started_at).').'); common_debug('Opportunistic queue manager did not have time to start on this action (max: '.$this->max_execution_time.' exceeded: '.abs(time()-$this->started_at).').');
} }
return false; return false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment