onefinestay/nameko — pull request #137 by mattbennett (2014-07-02 10:33:55+00:00)
Title: enable timeouts without eventlet

This PR fixes the bug but isn't very nice.

Notes:

* kombu.common.drain_consumer forces ``ignore_timeouts`` to ``True``. This PR lifts the method from kombu and modifies it to pass the kwarg through to ``eventloop``, so that it raises rather than swallows ``socket.timeout``.
* nameko.legacy.decorators.ensure (via nameko.legacy.channelhandler) swallows ALL errors and never gives up, which seems wrong
* This PR raises a specific ``WaiterTimeout`` exception on ``socket.timeout`` from ``drain_consumer``, and re-raises it it's seen in ``ensure``.

I can't write an integration test to demonstrate that timeouts are honoured because the nameko codebase does not have nova-compatible entrypoints. As an aside, maybe now is the time to remove the legacy module, even if we have to put it elsewhere.

I'm unconvinced that nameko.legacy.decorators.ensure should be implemented as it is. Kombu's ``ensure`` has much nicer behaviour (configurable intervals, max_retries, and only swallows channel/connection errors). I don't know why we have our own implementation.