[Zope-CVS] CVS: Packages/zasync/client/zasync - plugins.py:1.10

Gary Poster gary at zope.com
Wed Jan 19 23:29:22 EST 2005


Update of /cvs-repository/Packages/zasync/client/zasync
In directory cvs.zope.org:/tmp/cvs-serv30765/client/zasync

Modified Files:
	plugins.py 
Log Message:
Forward port changes from 1.0 branch



=== Packages/zasync/client/zasync/plugins.py 1.9 => 1.10 ===
--- Packages/zasync/client/zasync/plugins.py:1.9	Fri Jan  7 14:36:51 2005
+++ Packages/zasync/client/zasync/plugins.py	Wed Jan 19 23:29:21 2005
@@ -469,7 +469,7 @@
         'zope_exec: beginning worker thread %r', thread_id)
     global taskQueue, taskStatus, threadIds, callbacks, serverDown
     from zasync.client import app, max_conflict_resolution_attempts
-    application = None
+    application = remembered_failure = None
     try:
         while 1: # keep on looking for tasks
             # blocks:
@@ -484,6 +484,7 @@
                 continue
             toolpath, zopeDeferredId = zopeDeferredTuple
             for attempt in range(max_conflict_resolution_attempts):
+                remembered_failure = None
                 try:
                     try:
                         deferred = None
@@ -564,8 +565,7 @@
                             call = Expression(call)
                             try:
                                 res = call(context)
-                            except ((ConflictError, KeyboardInterrupt, 
-                                     SystemExit, ClientDisconnected)):
+                            except (ConflictError, ClientDisconnected):
                                 raise
                             except:
                                 res = failure.Failure()
@@ -610,6 +610,7 @@
                             break # the timeout errback is supposed to have
                             # been communicated within the main zasync thread
                     except ConflictError:
+                        remembered_failure = cleanFailure(failure.Failure())
                         get_transaction().abort() 
                         logger.debug(
                             'zope_exec: worker %s got conflict error', 
@@ -617,9 +618,6 @@
                         if attempt < max_conflict_resolution_attempts:
                             time.sleep(attempt + 1) # XXX better idea?
                         # (and continue, retrying if appropriate)
-                    except (KeyboardInterrupt, SystemExit):
-                        get_transaction().abort() 
-                        raise
                     except ClientDisconnected:
                         get_transaction().abort()
                         logger.debug(
@@ -646,8 +644,8 @@
                         # the failure back to the log (and Zope, if the tool
                         # and the associated deferred happen to magically 
                         # reappear).
+                        f = cleanFailure(failure.Failure())
                         get_transaction().abort()
-                        f = failure.Failure()
                         out = None
                         if client.verbose_traceback:
                             out = StringIO.StringIO()
@@ -719,6 +717,8 @@
                             callbacks.put((deferred, fail))
                         break
                 finally:
+                    if remembered_failure is None:
+                        remembered_failure = cleanFailure(failure.Failure())
                     if application is not None:
                         application._p_jar.close()
                         application = None
@@ -728,11 +728,13 @@
                     'giving up.', thread_id)
                 deferred = popTaskStatus(zopeDeferredTuple)
                 if deferred is not None and deferred is not CANCEL:
+                    if remembered_failure is None:
+                        remembered_failure = cleanFailure(failure.Failure())
                     logger.debug(
                         'zope_exec: worker %s scheduling failure message with '
                         'zasync', thread_id)
                     callbacks.put(
-                        (deferred, failure.Failure()))
+                        (deferred, remembered_failure))
     finally:
         logger.debug(
             'zope_exec: worker %s cleaning up and going away', thread_id)
@@ -749,5 +751,7 @@
                 logger.debug(
                     'zope_exec: worker %s scheduling failure message with '
                     'zasync', thread_id)
+                if remembered_failure is None:
+                    remembered_failure = cleanFailure(failure.Failure())
                 callbacks.put(
-                    (deferred, failure.Failure()))
+                    (deferred, remembered_failure))



More information about the Zope-CVS mailing list