[CalendarServer-changes] [11658] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Sep 6 11:54:13 PDT 2013
Revision: 11658
http://trac.calendarserver.org//changeset/11658
Author: sagen at apple.com
Date: 2013-09-06 11:54:13 -0700 (Fri, 06 Sep 2013)
Log Message:
-----------
Agent inactivity timeout now configurable
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/agent.py
CalendarServer/trunk/calendarserver/tools/test/test_agent.py
CalendarServer/trunk/twistedcaldav/stdconfig.py
Modified: CalendarServer/trunk/calendarserver/tools/agent.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/agent.py 2013-09-06 18:07:48 UTC (rev 11657)
+++ CalendarServer/trunk/calendarserver/tools/agent.py 2013-09-06 18:54:13 UTC (rev 11658)
@@ -243,7 +243,8 @@
log.warn("Agent inactive; shutting down")
reactor.stop()
- inactivityDetector = InactivityDetector(reactor, 60 * 10, becameInactive)
+ inactivityDetector = InactivityDetector(reactor,
+ config.AgentInactivityTimeoutSeconds, becameInactive)
root = Resource()
root.putChild("gateway", AgentGatewayResource(store,
davRootResource, directory, inactivityDetector))
@@ -278,8 +279,9 @@
self._timeoutSeconds = timeoutSeconds
self._becameInactive = becameInactive
- self._delayedCall = self._reactor.callLater(self._timeoutSeconds,
- self._inactivityThresholdReached)
+ if self._timeoutSeconds > 0:
+ self._delayedCall = self._reactor.callLater(self._timeoutSeconds,
+ self._inactivityThresholdReached)
def _inactivityThresholdReached(self):
@@ -295,19 +297,21 @@
Call this to let the InactivityMonitor that there has been activity.
It will reset the timeout.
"""
- if self._delayedCall.active():
- self._delayedCall.reset(self._timeoutSeconds)
- else:
- self._delayedCall = self._reactor.callLater(self._timeoutSeconds,
- self._inactivityThresholdReached)
+ if self._timeoutSeconds > 0:
+ if self._delayedCall.active():
+ self._delayedCall.reset(self._timeoutSeconds)
+ else:
+ self._delayedCall = self._reactor.callLater(self._timeoutSeconds,
+ self._inactivityThresholdReached)
def stop(self):
"""
Cancels the delayed call
"""
- if self._delayedCall.active():
- self._delayedCall.cancel()
+ if self._timeoutSeconds > 0:
+ if self._delayedCall.active():
+ self._delayedCall.cancel()
Modified: CalendarServer/trunk/calendarserver/tools/test/test_agent.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/test_agent.py 2013-09-06 18:07:48 UTC (rev 11657)
+++ CalendarServer/trunk/calendarserver/tools/test/test_agent.py 2013-09-06 18:54:13 UTC (rev 11658)
@@ -145,6 +145,9 @@
id.stop()
+ # Verify a timeout of 0 does not ever fire
+ id = InactivityDetector(clock, 0, becameInactive)
+ self.assertEquals(clock.getDelayedCalls(), [])
class FakeRequest(object):
Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py 2013-09-06 18:07:48 UTC (rev 11657)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py 2013-09-06 18:54:13 UTC (rev 11658)
@@ -1001,6 +1001,10 @@
# America/Los_Angeles.
"DefaultTimezone" : "",
+ # After this many seconds of no admin requests, shutdown the agent. Zero
+ # means no automatic shutdown.
+ "AgentInactivityTimeoutSeconds" : 4 * 60 * 60,
+
# These two aren't relative to ConfigRoot:
"Includes": [], # Other plists to parse after this one
"WritableConfigFile" : "", # which config file calendarserver_config should
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130906/15e640dd/attachment-0001.html>
More information about the calendarserver-changes
mailing list