0011870: Tinebase_ActionQueue - 100% CPU worker process
authorPaul Mehrer <p.mehrer@metaways.de>
Tue, 17 May 2016 12:19:32 +0000 (14:19 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 19 May 2016 08:27:20 +0000 (10:27 +0200)
if no proper backend is configured, the worker process
just quits instead of running in an infinite loop

https://forge.tine20.org/view.php?id=11870

Change-Id: I28344d2f5124ad8cd282908d9d9d6186b5c29331
Reviewed-on: http://gerrit.tine20.com/customers/3163
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/ActionQueue.php
tine20/Tinebase/ActionQueue/Worker.php

index e73f56f..f829bda 100644 (file)
     {
         return call_user_func_array(array($this->_queue, $name), $arguments);
     }
+
+     /**
+      * returns the class name of the used queue implementation
+      *
+      * @return string
+      */
+    public function getBackendType()
+    {
+        return get_class($this->_queue);
+    }
 }
index c8628da..8b15ff4 100755 (executable)
@@ -48,6 +48,11 @@ class Tinebase_ActionQueue_Worker extends Console_Daemon
      */
     public function run()
     {
+        if ('Tinebase_ActionQueue_Backend_Direct' === Tinebase_ActionQueue::getInstance()->getBackendType()) {
+            $this->_getLogger()->crit(__METHOD__ . '::' . __LINE__ . ' Tinebase_ActionQueue_Backend_Direct used. There is nothing to do for the worker! Configure Redis backend for example if you want to make use of the worker.');
+            exit(1);
+        }
+
         while (true) {
             
             // manage the number of children