[CalendarServer-changes] [8373] CalendarServer/trunk/twistedcaldav/memcachepool.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Dec 2 16:17:44 PST 2011
Revision: 8373
http://trac.macosforge.org/projects/calendarserver/changeset/8373
Author: sagen at apple.com
Date: 2011-12-02 16:17:44 -0800 (Fri, 02 Dec 2011)
Log Message:
-----------
When a memcache request fails, log (at least part of) the request body.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/memcachepool.py
Modified: CalendarServer/trunk/twistedcaldav/memcachepool.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/memcachepool.py 2011-12-02 21:36:00 UTC (rev 8372)
+++ CalendarServer/trunk/twistedcaldav/memcachepool.py 2011-12-03 00:17:44 UTC (rev 8373)
@@ -128,6 +128,8 @@
"""
clientFactory = MemCacheClientFactory
+ REQUEST_LOGGING_SIZE = 1024
+
def __init__(self, serverAddress, maxClients=5, reactor=None):
"""
@param serverAddress: An L{IPv4Address} indicating the server to
@@ -217,6 +219,16 @@
self.clientFree(client)
return result
+ def _reportError(failure):
+ """
+ Upon memcache error, log the failed request along with the error
+ message and free the client.
+ """
+ self.log_error("Memcache error: %s; request: %s %s" %
+ (failure.value, command,
+ " ".join(args)[:self.REQUEST_LOGGING_SIZE],))
+ self.clientFree(client)
+
self.clientBusy(client)
method = getattr(client, command, None)
if method is not None:
@@ -224,7 +236,7 @@
else:
d = fail(Failure(NoSuchCommand()))
- d.addCallback(_freeClientAfterRequest)
+ d.addCallbacks(_freeClientAfterRequest, _reportError)
return d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20111202/5ac513ed/attachment.html>
More information about the calendarserver-changes
mailing list