aboutsummaryrefslogtreecommitdiffstats
path: root/include/poller.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-10-20 20:10:43 -0700
committerfriendica <info@friendica.com>2014-10-20 20:10:43 -0700
commit34985f727264a5f3ca11095404f0eceb21f343b5 (patch)
tree8ee3d221ec8cabfd5d700ee455e84d77a0e77ab1 /include/poller.php
parentbac947c4dd6c635be9135388f7a99ec6a57cc3de (diff)
parentbcb4356fe03a5f4ba31319ab95f574e56d528cd5 (diff)
downloadvolse-hubzilla-34985f727264a5f3ca11095404f0eceb21f343b5.tar.gz
volse-hubzilla-34985f727264a5f3ca11095404f0eceb21f343b5.tar.bz2
volse-hubzilla-34985f727264a5f3ca11095404f0eceb21f343b5.zip
Merge https://github.com/friendica/red into pending_merge
Diffstat (limited to 'include/poller.php')
-rw-r--r--include/poller.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/poller.php b/include/poller.php
index 61298b0ab..d18cb1ca6 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -25,6 +25,15 @@ function poller_run($argv, $argc){
if(! $interval)
$interval = ((get_config('system','delivery_interval') === false) ? 3 : intval(get_config('system','delivery_interval')));
+ // Check for a logfile. If it exists, but is over an hour old, it's stale. Ignore it.
+ $lockfile = 'store/[data]/poller';
+ if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 3600))) {
+ logger("poller: Already running");
+ return;
+ }
+
+ // Create a lockfile. Needs two vars, but $x doesn't need to contain anything.
+ file_put_contents($lockfile, $x);
logger('poller: start');
@@ -375,7 +384,10 @@ function poller_run($argv, $argc){
}
}
}
-
+
+ //All done - clear the lockfile
+ @unlink($lockfile);
+
return;
}