+ $interval = ((get_config('system','delivery_interval') === false) ? 2 : intval(get_config('system','delivery_interval')));
+
+ // If we are using the worker we don't need a delivery interval
+ /// @TODO To much get_config() here
+ if (get_config("system", "worker")) {
+ $interval = false;
+ }
+
+ $r = q("select * from deliverq where 1");
+ if ($r) {
+ foreach ($r as $rr) {
+ logger('queue: deliverq');
+ proc_run(PRIORITY_HIGH,'include/delivery.php',$rr['cmd'],$rr['item'],$rr['contact']);
+ if ($interval) {
+ time_sleep_until(microtime(true) + (float) $interval);
+ }
+ }
+ }
+