[Twisted-Python] difficulty in calling callLater from callback

Itamar Shtull-Trauring itamar at itamarst.org
Wed Dec 10 13:38:21 EST 2003

On Wed, 2003-12-10 at 13:10, Martin Waite wrote:

> def read_loop():
>     dbpool.runInteraction( read_db_response ).addCallback( reactor.callLater, 1, read_loop )
> read_loop()
> =================
> I thought I could do this by attaching a callback to 
> dbpool.runInteraction(), and have that callback schedule
> the next call of read_loop().

Callbacks are expected to receive an argument, the result of the
previous callback/the deferred.

For example:

def read_loop():
    dbpool.runInteraction( read_db_response ).addCallback(
                   lambda _: reactor.callLater(1, read_loop ))

Itamar Shtull-Trauring    http://itamarst.org
Looking for a job: http://itamarst.org/resume.html

More information about the Twisted-Python mailing list