[FileJournal] Randomly prune old log entries.
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 7 Nov 2012 22:21:23 +0000 (14:21 -0800)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 9 Nov 2012 00:28:30 +0000 (00:28 +0000)
Change-Id: I667bfdaf167f2154d833b06de7115b4b292a0d2b

includes/filebackend/filejournal/DBFileJournal.php

index 34f3e53..44c6567 100644 (file)
@@ -75,6 +75,9 @@ class DBFileJournal extends FileJournal {
 
                try {
                        $dbw->insert( 'filejournal', $data, __METHOD__ );
+                       if ( mt_rand( 0, 99 ) == 0 ) {
+                               $this->purgeOldLogs(); // occasionally delete old logs
+                       }
                } catch ( DBError $e ) {
                        $status->fatal( 'filejournal-fail-dbquery', $this->backend );
                        return $status;