[Twisted-Python] difficulty in calling callLater from callback

Martin Waite martin at datacash.com
Wed Dec 10 13:10:09 EST 2003


I'm trying to get a set of database updates (read_db_response())
run once a second or so.

dbpool = adbapi.ConnectionPool( "MySQLdb", host = 'localhost', user = 'martin', passwd = 'passwd', db = 'request' )

def read_db_response(cursor):
    cursor.execute( "update 1" )
    cursor.execute( "update 2" )
    cursor.execute( "update 3" )
    return 1;

def read_loop():
    dbpool.runInteraction( read_db_response ).addCallback( reactor.callLater, 1, 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().

What happens is that read_db_response() runs exactly once.

Does anyone know what I have done wrong here ?


More information about the Twisted-Python mailing list