From: Brion Vibber Date: Thu, 27 Jan 2011 20:07:29 +0000 (-0800) Subject: Add $config['sessions']['gc_limit'] to limit how much work we do in each session... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=433ec211199aedc98e7d6949a17d6b5c2d0932f3;p=quix0rs-gnu-social.git Add $config['sessions']['gc_limit'] to limit how much work we do in each session GC; defaulting to killing 1000 sessions at a time. --- diff --git a/classes/Session.php b/classes/Session.php index e1c83ad4dc..166b89815a 100644 --- a/classes/Session.php +++ b/classes/Session.php @@ -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()) { diff --git a/lib/default.php b/lib/default.php index 85d27f5220..4b28e3238b 100644 --- a/lib/default.php +++ b/lib/default.php @@ -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,