Merge pull request #5980 from annando/dbclean-limit

The limit for dbclean is now configurable
2022.09-rc
Hypolite Petovan 2018-10-21 02:09:08 -04:00 zatwierdzone przez GitHub
commit 0e7e5446d6
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 8 dodań i 3 usunięć

Wyświetl plik

@ -121,9 +121,14 @@ db_loglimit_index_high = 0
; dbclean_expire_conversation (Integer) ; dbclean_expire_conversation (Integer)
; When DBClean is enabled, any entry in the conversation table will be deleted after this many days. ; 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_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) ; diaspora_test (Boolean)
; For development only. Disables the message transfer. ; For development only. Disables the message transfer.
diaspora_test = false diaspora_test = false

Wyświetl plik

@ -63,7 +63,7 @@ class DBClean {
$count = 0; $count = 0;
// We split the deletion in many small tasks // 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 // Get the expire days for step 8 and 9
$days = Config::get('system', 'dbclean-expire-days', 0); $days = Config::get('system', 'dbclean-expire-days', 0);
@ -275,7 +275,7 @@ class DBClean {
OR (`item`.`file` != '') OR (`item`.`event-id` != '') OR (`item`.`file` != '') OR (`item`.`event-id` != '')
OR (`item`.`attach` != '') OR `item`.`wall` OR `item`.`origin`) OR (`item`.`attach` != '') OR `item`.`wall` OR `item`.`origin`)
AND `item`.`parent` = `thread`.`iid`) 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); $count = DBA::numRows($r);
if ($count > 0) { if ($count > 0) {
logger("found expired threads: ".$count); logger("found expired threads: ".$count);