Add $config['sessions']['gc_limit'] to limit how much work we do in each session GC; defaulting to killing 1000 sessions at a time.

This commit is contained in:
Brion Vibber 2011-01-27 12:07:29 -08:00
parent 73011e6344
commit 433ec21119
2 changed files with 10 additions and 2 deletions

View File

@ -156,6 +156,13 @@ class Session extends Memcached_DataObject
$session->selectAdd();
$session->selectAdd('id');
$limit = common_config('sessions', 'gc_limit');
if ($limit > 0) {
// On large sites, too many sessions to expire
// at once will just result in failure.
$session->limit($limit);
}
$session->find();
while ($session->fetch()) {

View File

@ -261,8 +261,9 @@ $default =
'search' =>
array('type' => 'fulltext'),
'sessions' =>
array('handle' => false, // whether to handle sessions ourselves
'debug' => false), // debugging output for sessions
array('handle' => false, // whether to handle sessions ourselves
'debug' => false, // debugging output for sessions
'gc_limit' => 1000), // max sessions to expire at a time
'design' =>
array('backgroundcolor' => null, // null -> 'use theme default'
'contentcolor' => null,