- do {
- $qi = Queue_item::top($queue);
- if (!empty($qi)) {
- $notice = Notice::staticGet('id', $qi->notice_id);
- if (!empty($notice)) {
- $result = $notice;
+ /**
+ * Run a polling cycle during idle processing in the input loop.
+ * @return boolean true if we should poll again for more data immediately
+ */
+ public function poll()
+ {
+ $this->_log(LOG_DEBUG, 'Checking for notices...');
+ $qi = Queue_item::top($this->activeQueues());
+ if (empty($qi)) {
+ $this->_log(LOG_DEBUG, 'No notices waiting; idling.');
+ return false;
+ }
+
+ $queue = $qi->transport;
+ $item = $this->decode($qi->frame);
+
+ if ($item) {
+ $rep = $this->logrep($item);
+ $this->_log(LOG_INFO, "Got $rep for transport $queue");
+
+ $handler = $this->getHandler($queue);
+ if ($handler) {
+ if ($handler->handle($item)) {
+ $this->_log(LOG_INFO, "[$queue:$rep] Successfully handled item");
+ $this->_done($qi);