[Twisted-Python] Question about "starving" the reactor

Orestis Markou orestis at orestis.gr
Mon Jun 20 03:04:27 MDT 2011


Hello,

I have a question about the "best practices" on making callbacks and making sure you don't hog the reactor.

So you pass a deferred to a client, who attaches a chain of callbacks that might probably do some CPU intensive stuff. How should one guard for that? The obvious solution to me for the server part would be to do

reactor.callLater(0, d.callback, arg)

insted of

d.callback(arg)


What about the client part? What would be the best way to have a chain of callbacks executed in such a way that the reactor isn't blocking during that time?

Thanks,
Orestis





More information about the Twisted-Python mailing list