]> git.mxchange.org Git - friendica.git/blobdiff - include/queue.php
Merge pull request #1518 from tugelbend/develop
[friendica.git] / include / queue.php
index 4825eb8a4d4cb0524e5e637804fe37d5f01ea566..128dfcba57dd25dc18e8d339468680f5aa03551a 100644 (file)
@@ -84,11 +84,17 @@ function queue_run(&$argv, &$argc){
        load_config('config');
        load_config('system');
 
-       $lockpath = get_config('system','lockpath');
+       $lockpath = get_lockpath();
        if ($lockpath != '') {
-               $pidfile = new pidfile($lockpath, 'queue.lck');
+               $pidfile = new pidfile($lockpath, 'queue');
                if($pidfile->is_already_running()) {
                        logger("queue: Already running");
+                       if ($pidfile->running_time() > 9*60) {
+                               $pidfile->kill();
+                               logger("queue: killed stale process");
+                               // Calling a new instance
+                               proc_run('php',"include/queue.php");
+                       }
                        return;
                }
        }
@@ -259,6 +265,6 @@ function queue_run(&$argv, &$argc){
 }
 
 if (array_search(__file__,get_included_files())===0){
-  queue_run($argv,$argc);
+  queue_run($_SERVER["argv"],$_SERVER["argc"]);
   killme();
 }