[Twisted-Python] how to implement sleep?

ruslan usifov ruslan.usifov at gmail.com
Sun Sep 19 08:04:39 EDT 2010


Twisted is great, but how cant i emulate sleep behaviour in syested. I know
that exists callLater, but how to use it in yield scenario, like here:

def work(self):
    l_attempts = 0;

    while l_attemps < 3:
            resp = yield <some twisted call>

            yield sleep(3);
            l_attempts +=1

        log.err("cant communicate");

Here i make 3 attempts to connect busy service, with pause 3 seconds between
attempts. How cant i implement this in twisted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20100919/5f1a973d/attachment.htm 

More information about the Twisted-Python mailing list