Skip to content

Commit

Permalink
Always trap ConnectionDone on LocalWorker.endDeferred.
Browse files Browse the repository at this point in the history
The previous commit reverts the disttrial process management change so
that these Deferred's failures are never handled, so this one silences
the resulting `critical`-level log messages by unconditionally
trapping the ConnectionDone sent by `reap`.
  • Loading branch information
markrwilliams committed Feb 21, 2018
1 parent bf67e1e commit 0fce133
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/twisted/trial/_dist/test/test_disttrial.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from twisted.internet.defer import fail, gatherResults, maybeDeferred, succeed
from twisted.internet.task import Cooperator, deferLater
from twisted.internet.main import CONNECTION_DONE
from twisted.internet import reactor, interfaces
from twisted.internet import reactor, interfaces, error
from twisted.python.compat import NativeStringIO as StringIO
from twisted.python.failure import Failure
from twisted.python.lockfile import FilesystemLock
Expand Down Expand Up @@ -125,19 +125,17 @@ def setUp(self):
self.runner._stream = StringIO()


def reap(self, workers, consumeErrors=True):
def reap(self, workers):
"""
Reap the workers.
Reap the workers and trap L{ConnectionDone} failures on their
C{endDeferred}s.
@param workers: The workers to reap.
@type workers: An iterable of L{LocalWorker}
@param consumeErrors: Whether or not to suppress errors.
@type consumeErrors: L{bool}
"""

for worker in workers:
if consumeErrors:
worker.endDeferred.addErrback(lambda _: None)
worker.endDeferred.addErrback(Failure.trap, error.ConnectionDone)
worker.processEnded(Failure(CONNECTION_DONE))


Expand Down

0 comments on commit 0fce133

Please sign in to comment.