aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Daemon/Expire.php
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2020-03-31 19:57:05 +0200
committerMax Kostikov <max@kostikov.co>2020-03-31 19:57:05 +0200
commit084177a20c194767f227edb61acef236f99061f8 (patch)
tree60fcee6819a6347b0e4293ebdd10f845bc2c4446 /Zotlabs/Daemon/Expire.php
parent5a2c62466e773ce043a1b39bd2f1e7003a53d9f2 (diff)
downloadvolse-hubzilla-084177a20c194767f227edb61acef236f99061f8.tar.gz
volse-hubzilla-084177a20c194767f227edb61acef236f99061f8.tar.bz2
volse-hubzilla-084177a20c194767f227edb61acef236f99061f8.zip
Avoid multiple run of expiry procedure on large sites
Diffstat (limited to 'Zotlabs/Daemon/Expire.php')
-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..bce512b6d 100644
--- a/Zotlabs/Daemon/Expire.php
+++ b/Zotlabs/Daemon/Expire.php
@@ -9,6 +9,13 @@ class Expire {
cli_startup();
+ if ($pid = get_xconfig(0, 'expire', 'procid', false)) {
+ logger('Expire: procedure already run with PID ' . $pid);
+ return;
+ }
+
+ set_xconfig(0, 'expire', 'procid', getmypid());
+
// perform final cleanup on previously delete items
$r = q("select id from item where item_deleted = 1 and item_pending_remove = 0 and changed < %s - INTERVAL %s",
@@ -90,5 +97,7 @@ class Expire {
logger('Expire: sys: done', LOGGER_DEBUG);
}
+
+ del_xconfig(0, 'expire', 'procid');
}
}