terrycojones / txrdq

txRDQ (Resizable Dispatch Queue) provides a Twisted class for a controllable priority queue for running jobs.
Apache License 2.0
17 stars 4 forks source link

Don't allow a failure to go unhandled in a deferred #5

Closed terrycojones closed 10 years ago

terrycojones commented 10 years ago

Add an addErrback to ignore any error in the deferred we get from watching a launched a job. Hide the 'waiting' list on a job as we no longer need to access it. Cleaned up job docstring a little.

All the debugging & thinking to find this problem was done by @ldanielburr

Fixes #4

ldanielburr commented 10 years ago

How about we add the unit-test for this to test_rdq.py? Something like:

class TestDeferredHandling(unittest.TestCase):
    def _raiseException(self, a):
        raise Exception('An exception occurred.')

    def setUp(self):
        self.queue = ResizableDispatchQueue(self._raiseException, 1)

    def tearDown(self):
        pass

    def test_txrdq(self):
        d = self.queue.put("Some argument", 1)
        d = self.assertFailure(d, Job)
        return d
terrycojones commented 10 years ago

OK, I added two tests (which could have been one). If you're good with all this I'll merge and push it to PyPI.

ldanielburr commented 10 years ago

Looks good to me, thanks for resolving this so swiftly.

terrycojones commented 10 years ago

Ha - you're calling 3 years swiftly??? And... YOU resolved it :-)

terrycojones commented 10 years ago

OK, 0.2.14 is on PyPI https://pypi.python.org/pypi/txRDQ/0.2.14