buildbot/buildbot — pull request #1149 by djmitche (2014-05-06 02:42:01+00:00)
Title: Add a polling decorator

This is useful for ChangeSources and will probably be useful elsewhere as well, e.g., in polling for stray build requests. It solves the issue of cleanly shutting down services that may have asynchronous operations.

The tricky bit here was supporting the `force` method. LoopingCall does *not* support this method, and the current implementation is something of a hack. This method is only required by the poller hook. I can think of a few options:

* Eliminate the poller hook. This seems like a bad choice, as it's a legitimately useful tool.
* Refactor `poll.method` to not use LoopingCall, mostly by moving LoopingCall into `poll.method` and then factoring out redundancies. This is probably the best option.
* add a bunch more machinery to allow the decorated method to be called other than by LoopingCall, yet still have the `stop` method wait until it's complete. This seems to be heaping complexity on complexity.