aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Daemon/Poller.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Daemon/Poller.php')
-rw-r--r--Zotlabs/Daemon/Poller.php41
1 files changed, 30 insertions, 11 deletions
diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php
index 88213a7c9..0fdc3da16 100644
--- a/Zotlabs/Daemon/Poller.php
+++ b/Zotlabs/Daemon/Poller.php
@@ -17,9 +17,12 @@ class Poller {
}
}
- $interval = intval(get_config('system', 'poll_interval'));
- if (!$interval)
+ $interval = get_config('queueworker', 'queue_interval', 500000);
+
+/*
+ if (!$interval) {
$interval = ((get_config('system', 'delivery_interval') === false) ? 3 : intval(get_config('system', 'delivery_interval')));
+ }
// Check for a lockfile. If it exists, but is over an hour old, it's stale. Ignore it.
$lockfile = 'store/[data]/poller';
@@ -32,6 +35,7 @@ class Poller {
// Create a lockfile. Needs two vars, but $x doesn't need to contain anything.
$x = '';
file_put_contents($lockfile, $x);
+*/
logger('poller: start');
@@ -93,13 +97,24 @@ class Poller {
$min = intval(get_config('system', 'minimum_feedcheck_minutes'));
if (!$min)
$min = 60;
+
+ if ($t !== $c) {
+ // if the last fetch failed only attempt fetch once a day
+ $min = 60 * 24;
+ }
+
$x = datetime_convert('UTC', 'UTC', "now - $min minutes");
- if ($c < $x) {
+
+ if ($t < $x) {
Master::Summon(['Onepoll', $contact['abook_id']]);
- if ($interval)
- @time_sleep_until(microtime(true) + (float)$interval);
+
+ if ($interval) {
+ usleep($interval);
+ }
}
+
continue;
+
}
if ($contact['xchan_network'] !== 'zot6')
@@ -158,9 +173,10 @@ class Poller {
continue;
Master::Summon(['Onepoll', $contact['abook_id']]);
- if ($interval)
- @time_sleep_until(microtime(true) + (float)$interval);
+ if ($interval) {
+ usleep($interval);
+ }
}
}
@@ -181,9 +197,12 @@ class Poller {
if ($rr['ud_last'] > NULL_DATE)
if ($rr['ud_last'] > datetime_convert('UTC', 'UTC', 'now - 1 day'))
continue;
+
Master::Summon(['Onedirsync', $rr['ud_id']]);
- if ($interval)
- @time_sleep_until(microtime(true) + (float)$interval);
+
+ if ($interval) {
+ usleep($interval);
+ }
}
}
}
@@ -191,9 +210,9 @@ class Poller {
set_config('system', 'lastpoll', datetime_convert());
//All done - clear the lockfile
-
+/*
@unlink($lockfile);
-
+*/
return;
}
}