From c4cc7a4afbeeb908e660bc53f62c05e018981232 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 21 Oct 2018 05:41:40 +0000 Subject: [PATCH] The limit for dbclean is now configurable --- config/config.ini.php | 7 ++++++- src/Worker/DBClean.php | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config/config.ini.php b/config/config.ini.php index ea3df52cbd..a324e709ec 100644 --- a/config/config.ini.php +++ b/config/config.ini.php @@ -121,9 +121,14 @@ db_loglimit_index_high = 0 ; dbclean_expire_conversation (Integer) ; When DBClean is enabled, any entry in the conversation table will be deleted after this many days. -; These data are normally needed only for debugging purposes and they are safe to delete. +: This data is used for ActivityPub, so it shouldn't be lower than the average duration of a discussion. dbclean_expire_conversation = 90 +; dbclean-expire-limit (Integer) +; This defines the number of items that are to be deleted in a single call. +; Reduce this value when you are getting memory issues. +dbclean-expire-limit = 1000 + ; diaspora_test (Boolean) ; For development only. Disables the message transfer. diaspora_test = false diff --git a/src/Worker/DBClean.php b/src/Worker/DBClean.php index ca0da954c0..dba9cfd4c6 100644 --- a/src/Worker/DBClean.php +++ b/src/Worker/DBClean.php @@ -63,7 +63,7 @@ class DBClean { $count = 0; // We split the deletion in many small tasks - $limit = 1000; + $limit = Config::get('system', 'dbclean-expire-limit', 1000); // Get the expire days for step 8 and 9 $days = Config::get('system', 'dbclean-expire-days', 0); @@ -275,7 +275,7 @@ class DBClean { OR (`item`.`file` != '') OR (`item`.`event-id` != '') OR (`item`.`attach` != '') OR `item`.`wall` OR `item`.`origin`) AND `item`.`parent` = `thread`.`iid`) - ORDER BY `thread`.`iid` LIMIT 1000", $days, $last_id); + ORDER BY `thread`.`iid` LIMIT ?", $days, $last_id, $limit); $count = DBA::numRows($r); if ($count > 0) { logger("found expired threads: ".$count); -- 2.39.5