}
} 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.
$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;
}
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");
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;
}