use a soft limit so there's not a whole bunch of deletes on every write

This commit is contained in:
Evan Prodromou 2009-07-16 00:26:51 -04:00
parent da512ad8c2
commit 83cbf246a8
2 changed files with 4 additions and 1 deletions

View File

@ -875,7 +875,9 @@ class Notice extends Memcached_DataObject
} }
$qry .= '('.$id.', '.$this->id.', '.$source.', "'.$this->created.'") '; $qry .= '('.$id.', '.$this->id.', '.$source.', "'.$this->created.'") ';
$cnt++; $cnt++;
if (rand() % NOTICE_INBOX_SOFT_LIMIT == 0) {
Notice_inbox::gc($id); Notice_inbox::gc($id);
}
if ($cnt >= MAX_BOXCARS) { if ($cnt >= MAX_BOXCARS) {
$inbox = new Notice_inbox(); $inbox = new Notice_inbox();
$inbox->query($qry); $inbox->query($qry);

View File

@ -27,6 +27,7 @@ define('INBOX_CACHE_WINDOW', 101);
define('NOTICE_INBOX_GC_BOXCAR', 128); define('NOTICE_INBOX_GC_BOXCAR', 128);
define('NOTICE_INBOX_GC_MAX', 12800); define('NOTICE_INBOX_GC_MAX', 12800);
define('NOTICE_INBOX_LIMIT', 1000); define('NOTICE_INBOX_LIMIT', 1000);
define('NOTICE_INBOX_SOFT_LIMIT', 1000);
define('NOTICE_INBOX_SOURCE_SUB', 1); define('NOTICE_INBOX_SOURCE_SUB', 1);
define('NOTICE_INBOX_SOURCE_GROUP', 2); define('NOTICE_INBOX_SOURCE_GROUP', 2);