~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/mailman/monkeypatches/xmlrpcrunner.py

  • Committer: Gary Poster
  • Date: 2011-07-27 14:01:17 UTC
  • mto: This revision was merged to the branch mainline in revision 13541.
  • Revision ID: gary.poster@canonical.com-20110727140117-i3g8y064c2gvsqfp
add a timeout for xmlrpc clients, so that mailman can recover more quickly when there is a service degradation from Launchpad.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
# XXX sinzui 2008-08-15 bug=258423:
40
40
# We should be importing from lazr.errorlog.
41
41
from canonical.launchpad.webapp.errorlog import ErrorReportingUtility
 
42
from lp.services.xmlrpc import Transport
42
43
 
43
44
 
44
45
COMMASPACE = ', '
52
53
 
53
54
 
54
55
def get_mailing_list_api_proxy():
55
 
    return xmlrpclib.ServerProxy(mm_cfg.XMLRPC_URL)
 
56
    return xmlrpclib.ServerProxy(
 
57
        mm_cfg.XMLRPC_URL, transport=Transport(timeout=5))
56
58
 
57
59
 
58
60
class MailmanErrorUtility(ErrorReportingUtility):
313
315
                # See if the case is changing.
314
316
                current_address = mlist.getMemberCPAddress(address)
315
317
                future_address = key_to_case_preserved[address]
316
 
                # pylint: disable-msg=W0331
317
 
                if current_address <> future_address:
 
318
                if current_address != future_address:
318
319
                    mlist.changeMemberAddress(address, future_address)
319
320
                    found_updates.append('%s -> %s' %
320
321
                                         (address, future_address))
321
322
                # flags are ignored for now.
322
323
                realname, flags, status = member_map[future_address]
323
 
                # pylint: disable-msg=W0331
324
 
                if realname <> mlist.getMemberName(address):
 
324
                if realname != mlist.getMemberName(address):
325
325
                    mlist.setMemberName(address, realname)
326
326
                    found_updates.append('%s new name: %s' %
327
327
                                         (address, realname))
328
 
                # pylint: disable-msg=W0331
329
 
                if status <> mlist.getDeliveryStatus(address):
 
328
                if status != mlist.getDeliveryStatus(address):
330
329
                    mlist.setDeliveryStatus(address, status)
331
330
                    found_updates.append('%s new status: %s' %
332
331
                                         (address, status))
341
340
    def _get_subscriptions(self):
342
341
        """Get the latest subscription information."""
343
342
        # First, calculate the names of the active mailing lists.
344
 
        # pylint: disable-msg=W0331
345
343
        lists = sorted(list_name
346
344
                       for list_name in Utils.list_names()
347
 
                       if list_name <> mm_cfg.MAILMAN_SITE_LIST)
 
345
                       if list_name != mm_cfg.MAILMAN_SITE_LIST)
348
346
        # Batch the subscription requests in order to reduce the possibility
349
347
        # of timeouts in the XMLRPC server.  Note that we cannot eliminate
350
348
        # timeouts, which will cause an entire batch to fail.  To reduce the