[Buildbot-devel] deferreds from polling change source
Jorge Gonzalez
gjorge at google.com
Tue Jul 2 01:29:49 UTC 2013
Thanks Tom. This is what I was looking for:
twisted.internet.threads.deferToThread<http://twistedmatrix.com/documents/13.0.0/api/twisted.internet.threads.deferToThread.html>
Jorge
On Thu, Jun 27, 2013 at 4:14 PM, Tom Prince <tom.prince at ualberta.net> wrote:
> Jorge Gonzalez <gjorge at google.com> writes:
> > def poll(self):
> > defered_poll = defer.Deferred()
> > defered_poll.addCallback(lambda _: self.DoTheActualPoll())
> > defered_poll.callback(None)
> > return defered_poll
>
> `.doTheActualPoll` will just be called when `.callback` is
> called. Deferreds don't magically make something asynchronous, they are
> just a way of organizing callbacks.
>
> The right way to do this is to change `.doTheActualPoll` to be
> asynchronous. How to do this will depend on what is doing. Anything else
> will cause everything to freeze while it is running.
>
> Tom
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20130701/3c23937c/attachment.html>
More information about the devel
mailing list