]> git.mxchange.org Git - friendica.git/commitdiff
Store spooled data
authorMichael <heluecht@pirati.ca>
Thu, 1 Dec 2016 20:53:18 +0000 (20:53 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 1 Dec 2016 20:53:18 +0000 (20:53 +0000)
include/items.php
include/poller.php
mod/worker.php

index 8aa292b3085d29cb41e032b1e37a64b118189dff..6d45550a4f98f0ab576b62569b4e46d263180d5f 100644 (file)
@@ -846,7 +846,6 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
                }
        } else {
                // This can happen - for example - if there are locking timeouts.
-               logger("Item wasn't stored - we quit here.");
                q("ROLLBACK");
 
                // Store the data into a spool file so that we can try again later.
@@ -856,8 +855,10 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
                        $arr['dsprsig'] = $encoded_signature;
 
                // Now we store the data in the spool directory
-               $spool = get_spoolpath().'/'.round(microtime(true) * 10000).".msg";
+               $file = 'item-'.round(microtime(true) * 10000).".msg";
+               $spool = get_spoolpath().'/'.$file;
                file_put_contents($spool, json_encode($arr));
+               logger("Item wasn't stored - Item was spooled into file ".$file, LOGGER_DEBUG);
                return 0;
        }
 
index b3a66fc389d467476db31c16d36eebb53454fcad..925de3fe5b04994cb6102b425850e5d9d6c3e810 100644 (file)
@@ -556,6 +556,9 @@ function clear_worker_processes() {
 function poller_run_cron() {
        logger('Add cron entries', LOGGER_DEBUG);
 
+       // Check for spooled items
+       proc_run(PRIORITY_HIGH, "include/spool_post.php");
+
        // Run the cron job that calls all other jobs
        proc_run(PRIORITY_MEDIUM, "include/cron.php");
 
index aebffed7447d36313b7ff96ae26bfdc7d1f9b687..c202a28d64d95feb1765485efad7733ab3fa96c3 100644 (file)
@@ -14,8 +14,10 @@ function worker_init($a){
                return;
        }
 
-       // We don't need the following lines if we can execute background jobs
+       // We don't need the following lines if we can execute background jobs.
+       // So we just wake up the worker if it sleeps.
        if (function_exists("proc_open")) {
+               call_worker_if_idle();
                return;
        }