[CalendarServer-changes] [11643] CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2
source_changes at macosforge.org
source_changes at macosforge.org
Mon Aug 26 10:39:17 PDT 2013
Revision: 11643
http://trac.calendarserver.org//changeset/11643
Author: glyph at apple.com
Date: 2013-08-26 10:39:17 -0700 (Mon, 26 Aug 2013)
Log Message:
-----------
Nice `str`/`repr` values for `WorkerStatus`, since we should really be able to log these for debugging purposes.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2/metafd.py
CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2/test/test_metafd.py
Modified: CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2/metafd.py
===================================================================
--- CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2/metafd.py 2013-08-26 17:39:11 UTC (rev 11642)
+++ CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2/metafd.py 2013-08-26 17:39:17 UTC (rev 11643)
@@ -30,6 +30,7 @@
from twext.web2.channel.http import HTTPFactory
from twisted.application.service import MultiService, Service
from twisted.internet import reactor
+from twisted.python.util import FancyStrMixin
from twisted.internet.tcp import Server
log = Logger()
@@ -161,11 +162,13 @@
@total_ordering
-class WorkerStatus(object):
+class WorkerStatus(FancyStrMixin, object):
"""
The status of a worker process.
"""
+ showAttributes = "acknowledged unacknowledged started abandoned".split()
+
def __init__(self, acknowledged=0, unacknowledged=0, started=0,
abandoned=0):
"""
Modified: CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2/test/test_metafd.py
===================================================================
--- CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2/test/test_metafd.py 2013-08-26 17:39:11 UTC (rev 11642)
+++ CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2/test/test_metafd.py 2013-08-26 17:39:17 UTC (rev 11643)
@@ -30,6 +30,7 @@
from twisted.application.service import Service
from twext.internet.test.test_sendfdport import ReaderAdder
+from twext.web2.metafd import WorkerStatus
from twisted.trial.unittest import TestCase
@@ -192,7 +193,17 @@
self.assertEquals(builder.port.reading, True)
+ def test_workerStatusRepr(self):
+ """
+ L{WorkerStatus.__repr__} will show all the values associated with the
+ status of the worker.
+ """
+ self.assertEquals(repr(WorkerStatus(1, 2, 3, 4)),
+ "<WorkerStatus acknowledged=1 unacknowledged=2 "
+ "started=3 abandoned=4>")
+
+
class LimiterBuilder(object):
"""
A L{LimiterBuilder} can build a L{ConnectionLimiter} and associated objects
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130826/5e79f3dc/attachment-0001.html>
More information about the calendarserver-changes
mailing list