diff options
author | Mark Sapiro <msapiro@value.net> | 2011-09-29 17:40:26 -0700 |
---|---|---|
committer | Mark Sapiro <msapiro@value.net> | 2011-09-29 17:40:26 -0700 |
commit | d95db9c7a7e6369546dd00e74feeaf02603333d4 (patch) | |
tree | 2caf09ff5212dd567c83fd94e219bb5237aeeb5c /Mailman | |
parent | beb580502a8dc928b0ca3fe35f36be9cf89ab9e1 (diff) | |
download | mailman2-d95db9c7a7e6369546dd00e74feeaf02603333d4.tar.gz mailman2-d95db9c7a7e6369546dd00e74feeaf02603333d4.tar.xz mailman2-d95db9c7a7e6369546dd00e74feeaf02603333d4.zip |
Eliminated the list cache from the qrunners. Indirect self-references
caused lists to never be dropped from the cache which in turn caused
the qrunners to grow very large in installations with many lists or
multiple large lists. Bug #862683.
Diffstat (limited to 'Mailman')
-rw-r--r-- | Mailman/Queue/Runner.py | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/Mailman/Queue/Runner.py b/Mailman/Queue/Runner.py index 3ab1bcf0..26bd0c29 100644 --- a/Mailman/Queue/Runner.py +++ b/Mailman/Queue/Runner.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2008 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2011 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -20,7 +20,6 @@ import time import traceback -import weakref from cStringIO import StringIO from Mailman import mm_cfg @@ -198,22 +197,18 @@ class Runner: if keepqueued: self._switchboard.enqueue(msg, msgdata) - # Mapping of listnames to MailList instances as a weak value dictionary. - _listcache = weakref.WeakValueDictionary() - def _open_list(self, listname): - # Cache the open list so that any use of the list within this process - # uses the same object. We use a WeakValueDictionary so that when the - # list is no longer necessary, its memory is freed. - mlist = self._listcache.get(listname) - if not mlist: - try: - mlist = MailList.MailList(listname, lock=False) - except Errors.MMListError, e: - syslog('error', 'error opening list: %s\n%s', listname, e) - return None - else: - self._listcache[listname] = mlist + # We no longer cache the list instances. Because of changes to + # MailList.py needed to avoid not reloading an updated list, caching + # is not as effective as it once was. Also, with OldStyleMemberships + # as the MemberAdaptor, there was a self-reference to the list which + # kept all lists in the cache. Changing this reference to a + # weakref.proxy created other issues. + try: + mlist = MailList.MailList(listname, lock=False) + except Errors.MMListError, e: + syslog('error', 'error opening list: %s\n%s', listname, e) + return None return mlist def _log(self, exc): |