[CalendarServer-changes] [4052] CalendarServer/branches/users/sagen/resource-delegates-4038
source_changes at macosforge.org
source_changes at macosforge.org
Tue Apr 21 12:17:32 PDT 2009
Revision: 4052
http://trac.macosforge.org/projects/calendarserver/changeset/4052
Author: sagen at apple.com
Date: 2009-04-21 12:17:29 -0700 (Tue, 21 Apr 2009)
Log Message:
-----------
Implicit scheduling now honors the auto-schedule value that caldav_utility.py sets.
Modified Paths:
--------------
CalendarServer/branches/users/sagen/resource-delegates-4038/bin/caldav_utility.py
CalendarServer/branches/users/sagen/resource-delegates-4038/twistedcaldav/memcachepool.py
CalendarServer/branches/users/sagen/resource-delegates-4038/twistedcaldav/resource.py
CalendarServer/branches/users/sagen/resource-delegates-4038/twistedcaldav/scheduling/processing.py
Modified: CalendarServer/branches/users/sagen/resource-delegates-4038/bin/caldav_utility.py
===================================================================
--- CalendarServer/branches/users/sagen/resource-delegates-4038/bin/caldav_utility.py 2009-04-21 15:35:30 UTC (rev 4051)
+++ CalendarServer/branches/users/sagen/resource-delegates-4038/bin/caldav_utility.py 2009-04-21 19:17:29 UTC (rev 4052)
@@ -52,6 +52,7 @@
from twistedcaldav.customxml import calendarserver_namespace
from twistedcaldav.directory.directory import DirectoryService, DirectoryRecord
from twistedcaldav.directory.principal import DirectoryPrincipalProvisioningResource
+from twistedcaldav.log import setLogLevelForNamespace
from twistedcaldav.notify import installNotificationClient
from twistedcaldav.static import CalendarHomeProvisioningFile
import itertools
@@ -202,8 +203,7 @@
print "Auto-Schedule: %s" % ("True" if result else "False",)
- print "Stopping reactor"
- reactor.callLater(0, reactor.stop)
+ reactor.stop()
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -311,6 +311,8 @@
def setup():
+ setLogLevelForNamespace(None, "warn")
+
directory = getDirectory()
if config.Memcached["ClientEnabled"]:
memcachepool.installPool(
Modified: CalendarServer/branches/users/sagen/resource-delegates-4038/twistedcaldav/memcachepool.py
===================================================================
--- CalendarServer/branches/users/sagen/resource-delegates-4038/twistedcaldav/memcachepool.py 2009-04-21 15:35:30 UTC (rev 4051)
+++ CalendarServer/branches/users/sagen/resource-delegates-4038/twistedcaldav/memcachepool.py 2009-04-21 19:17:29 UTC (rev 4052)
@@ -67,6 +67,11 @@
"""
Notify the connectionPool that we've lost our connection.
"""
+
+ if self.connectionPool.shutdown_requested:
+ # The reactor is stopping; don't reconnect
+ return
+
self.log_error("MemCache connection lost: %s" % (reason,))
if self._protocolInstance is not None:
self.connectionPool.clientBusy(self._protocolInstance)
@@ -90,7 +95,6 @@
connector,
reason)
-
def buildProtocol(self, addr):
"""
Attach the C{self.connectionPool} to the protocol so it can tell it,
@@ -138,14 +142,23 @@
if reactor is None:
from twisted.internet import reactor
-
self._reactor = reactor
+ self.shutdown_deferred = None
+ self.shutdown_requested = False
+ reactor.addSystemEventTrigger('before', 'shutdown', self._shutdownCallback)
+
self._busyClients = set([])
self._freeClients = set([])
self._pendingConnects = 0
self._commands = []
+ def _shutdownCallback(self):
+ self.shutdown_requested = True
+ if len(self._busyClients) == 0 and len(self._commands) == 0 and self._pendingConnects == 0:
+ return None
+ self.shutdown_deferred = Deferred()
+ return self.shutdown_deferred
def _newClientConnection(self):
"""
@@ -165,6 +178,7 @@
return client
factory = self.clientFactory()
+ factory.noisy = False
factory.connectionPool = self
@@ -274,6 +288,10 @@
@param client: An instance of C{self.clientFactory}
"""
+
+ if self.shutdown_deferred and len(self._busyClients) == 0 and len(self._commands) == 0 and self._pendingConnects == 0:
+ self.shutdown_deferred.callback(None)
+
if client in self._freeClients:
self._freeClients.remove(client)
@@ -294,6 +312,9 @@
self._freeClients.add(client)
+ if self.shutdown_deferred and len(self._busyClients) == 0 and len(self._commands) == 0 and self._pendingConnects == 0:
+ self.shutdown_deferred.callback(None)
+
if len(self._commands) > 0:
d, command, args, kwargs = self._commands.pop(0)
Modified: CalendarServer/branches/users/sagen/resource-delegates-4038/twistedcaldav/resource.py
===================================================================
--- CalendarServer/branches/users/sagen/resource-delegates-4038/twistedcaldav/resource.py 2009-04-21 15:35:30 UTC (rev 4051)
+++ CalendarServer/branches/users/sagen/resource-delegates-4038/twistedcaldav/resource.py 2009-04-21 19:17:29 UTC (rev 4052)
@@ -1066,18 +1066,15 @@
class ResourceInfoDBMemcacher(Memcacher):
def setAutoSchedule(self, guid, autoSchedule):
- print "Sending to memcache", "1" if autoSchedule else "0"
return self.set("resourceinfo:%s" % (str(guid),), "1" if autoSchedule else "0")
@inlineCallbacks
def getAutoSchedule(self, guid):
result = (yield self.get("resourceinfo:%s" % (str(guid),)))
- print "Result from memcache is:", result
if result is not None:
autoSchedule = result == "1"
else:
autoSchedule = None
- print "Therefore, getting back from memcache:", autoSchedule
returnValue(autoSchedule)
def __init__(self, path):
Modified: CalendarServer/branches/users/sagen/resource-delegates-4038/twistedcaldav/scheduling/processing.py
===================================================================
--- CalendarServer/branches/users/sagen/resource-delegates-4038/twistedcaldav/scheduling/processing.py 2009-04-21 15:35:30 UTC (rev 4051)
+++ CalendarServer/branches/users/sagen/resource-delegates-4038/twistedcaldav/scheduling/processing.py 2009-04-21 19:17:29 UTC (rev 4052)
@@ -268,7 +268,7 @@
raise ImplicitProcessorException(iTIPRequestStatus.NO_USER_SUPPORT)
log.debug("ImplicitProcessing - originator '%s' to recipient '%s' ignoring METHOD:REQUEST, UID: '%s' - new processed" % (self.originator.cuaddr, self.recipient.cuaddr, self.uid))
- autoprocessed = self.recipient.principal.getAutoSchedule()
+ autoprocessed = (yield self.recipient.principal.getAutoSchedule())
new_calendar = iTipProcessing.processNewRequest(self.message, self.recipient.cuaddr, autoprocessing=autoprocessed)
name = md5(str(new_calendar) + str(time.time()) + default.fp.path).hexdigest() + ".ics"
@@ -291,7 +291,7 @@
result = (True, autoprocessed, changes,)
else:
# Processing update to existing event
- autoprocessed = self.recipient.principal.getAutoSchedule()
+ autoprocessed = (yield self.recipient.principal.getAutoSchedule())
new_calendar, props_changed, rids = iTipProcessing.processRequest(self.message, self.recipient_calendar, self.recipient.cuaddr, autoprocessing=autoprocessed)
if new_calendar:
@@ -350,7 +350,7 @@
else:
# Need to check for auto-respond attendees. These need to suppress the inbox message
# if the cancel is processed.
- autoprocessed = self.recipient.principal.getAutoSchedule()
+ autoprocessed = (yield self.recipient.principal.getAutoSchedule())
# Check to see if this is a cancel of the entire event
processed_message, delete_original, rids = iTipProcessing.processCancel(self.message, self.recipient_calendar, autoprocessing=autoprocessed)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090421/392797d0/attachment-0001.html>
More information about the calendarserver-changes
mailing list