Tinebase_ActionQueue_Worker: do not init tine20 framework in parent
authorPaul Mehrer <p.mehrer@metaways.de>
Mon, 19 Jun 2017 11:28:59 +0000 (13:28 +0200)
committerPaul Mehrer <p.mehrer@metaways.de>
Tue, 20 Jun 2017 07:29:58 +0000 (09:29 +0200)
the child process will initiate the tine20 framework. The parent process
must not. As the child process will get a copy of the parents memory, they
want a fresh start. Especially with no filehandles, like DB connections, etc.

Change-Id: Iaf34d88c69df8a2664d4dc206576544f718d60f2
Reviewed-on: http://gerrit.tine20.com/customers/4896
Reviewed-by: Paul Mehrer <p.mehrer@metaways.de>
Tested-by: Paul Mehrer <p.mehrer@metaways.de>
tine20/Tinebase/ActionQueue/Worker.php

index 5b87d94..8633ba8 100755 (executable)
@@ -52,7 +52,12 @@ class Tinebase_ActionQueue_Worker extends Console_Daemon
      */
     public function run()
     {
-        if ('Tinebase_ActionQueue_Backend_Direct' === Tinebase_ActionQueue::getInstance()->getBackendType()) {
+        $actionQueueConfig = Tinebase_Core::getConfig()->getConfigFileSection(Tinebase_Config::ACTIONQUEUE);
+        if (!is_array($actionQueueConfig) || !isset($actionQueueConfig[Tinebase_Config::ACTIONQUEUE]) ||
+                !is_array($actionQueueConfig[Tinebase_Config::ACTIONQUEUE]) ||
+                !isset($actionQueueConfig[Tinebase_Config::ACTIONQUEUE][Tinebase_Config::ACTIONQUEUE_BACKEND]) ||
+                'redis' !== strtolower(
+                    $actionQueueConfig[Tinebase_Config::ACTIONQUEUE][Tinebase_Config::ACTIONQUEUE_BACKEND])) {
             $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);
         }