aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2020-04-03 10:49:57 +0200
committerMario <mario@mariovavti.com>2020-04-03 10:49:57 +0200
commit4b3979df04e0cba12049dced3ba037a004c324f6 (patch)
tree346083c8da35103eb18036855eb1de7fee6ee999
parent38be2386dd63a4a18c07e445b9859a5836ed5b46 (diff)
downloadvolse-hubzilla-4b3979df04e0cba12049dced3ba037a004c324f6.tar.gz
volse-hubzilla-4b3979df04e0cba12049dced3ba037a004c324f6.tar.bz2
volse-hubzilla-4b3979df04e0cba12049dced3ba037a004c324f6.zip
Avoid multiple run of expiry procedure on large sites
-rw-r--r--Zotlabs/Daemon/Expire.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/Zotlabs/Daemon/Expire.php b/Zotlabs/Daemon/Expire.php
index 398425861..f3f42df6f 100644
--- a/Zotlabs/Daemon/Expire.php
+++ b/Zotlabs/Daemon/Expire.php
@@ -8,6 +8,13 @@ class Expire {
static public function run($argc,$argv){
cli_startup();
+
+ if ($pid = get_config('expire', 'procid', false) && (function_exists('posix_kill') ? posix_kill($pid, 0) : true)) {
+ logger('Expire: procedure already run with PID ' . $pid, LOGGER_DEBUG);
+ return;
+ }
+
+ set_config('expire', 'procid', getmypid());
// perform final cleanup on previously delete items
@@ -90,5 +97,7 @@ class Expire {
logger('Expire: sys: done', LOGGER_DEBUG);
}
+
+ del_config('expire', 'procid');
}
}