[CalendarServer-changes] [6829] CalendarServer/branches/users/glyph/db-reconnect/twext/enterprise/ adbapi2.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 28 17:40:06 PST 2011


Revision: 6829
          http://trac.macosforge.org/projects/calendarserver/changeset/6829
Author:   glyph at apple.com
Date:     2011-01-28 17:40:05 -0800 (Fri, 28 Jan 2011)
Log Message:
-----------
retry (too aggressively)

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/db-reconnect/twext/enterprise/adbapi2.py

Modified: CalendarServer/branches/users/glyph/db-reconnect/twext/enterprise/adbapi2.py
===================================================================
--- CalendarServer/branches/users/glyph/db-reconnect/twext/enterprise/adbapi2.py	2011-01-29 01:39:55 UTC (rev 6828)
+++ CalendarServer/branches/users/glyph/db-reconnect/twext/enterprise/adbapi2.py	2011-01-29 01:40:05 UTC (rev 6829)
@@ -407,7 +407,6 @@
             connection = self.connectionFactory()
             cursor = connection.cursor()
             return (connection, cursor)
-        d = holder.submit(initCursor)
         def finishInit((connection, cursor)):
             baseTxn = BaseSqlTxn(
                 connectionFactory=self.connectionFactory,
@@ -417,7 +416,16 @@
             )
             txn._baseTxn = baseTxn
             self.reclaim(txn)
-        d.addCallbacks(finishInit, log.err)
+        def maybeTryAgain(f):
+            # not all errors are errors in connect() - in particular there's the
+            # possibility of errors in submit(); TODO: test for shutdown while
+            # connecting.
+            log.err(f)
+            self.reactor.callLater(self.RETRY_TIMEOUT, resubmit)
+        def resubmit():
+            d = holder.submit(initCursor)
+            d.addCallbacks(finishInit, maybeTryAgain)
+        resubmit()
         return txn
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110128/0d80d08f/attachment.html>


More information about the calendarserver-changes mailing list