alert to what transport we're checking for

This commit is contained in:
Evan Prodromou 2009-04-23 10:08:26 +00:00
parent a3e727823d
commit 7c383dc1d4

View File

@ -36,7 +36,7 @@ class QueueHandler extends Daemon
$this->set_id($id); $this->set_id($id);
} }
} }
function class_name() function class_name()
{ {
return ucfirst($this->transport()) . 'Handler'; return ucfirst($this->transport()) . 'Handler';
@ -46,7 +46,7 @@ class QueueHandler extends Daemon
{ {
return strtolower($this->class_name().'.'.$this->get_id()); return strtolower($this->class_name().'.'.$this->get_id());
} }
function get_id() function get_id()
{ {
return $this->_id; return $this->_id;
@ -56,16 +56,16 @@ class QueueHandler extends Daemon
{ {
$this->_id = $id; $this->_id = $id;
} }
function transport() function transport()
{ {
return null; return null;
} }
function start() function start()
{ {
} }
function finish() function finish()
{ {
} }
@ -74,14 +74,14 @@ class QueueHandler extends Daemon
{ {
return true; return true;
} }
function run() function run()
{ {
if (!$this->start()) { if (!$this->start()) {
return false; return false;
} }
$this->log(LOG_INFO, 'checking for queued notices');
$transport = $this->transport(); $transport = $this->transport();
$this->log(LOG_INFO, 'checking for queued notices for "' . $transport . '"');
do { do {
$qi = Queue_item::top($transport); $qi = Queue_item::top($transport);
if ($qi) { if ($qi) {
@ -113,7 +113,7 @@ class QueueHandler extends Daemon
} else { } else {
$this->clear_old_claims(); $this->clear_old_claims();
$this->idle(5); $this->idle(5);
} }
} while (true); } while (true);
if (!$this->finish()) { if (!$this->finish()) {
return false; return false;
@ -127,7 +127,7 @@ class QueueHandler extends Daemon
sleep($timeout); sleep($timeout);
} }
} }
function clear_old_claims() function clear_old_claims()
{ {
$qi = new Queue_item(); $qi = new Queue_item();
@ -137,10 +137,9 @@ class QueueHandler extends Daemon
$qi->free(); $qi->free();
unset($qi); unset($qi);
} }
function log($level, $msg) function log($level, $msg)
{ {
common_log($level, $this->class_name() . ' ('. $this->get_id() .'): '.$msg); common_log($level, $this->class_name() . ' ('. $this->get_id() .'): '.$msg);
} }
} }