*My first post somehow didn't make it to the group, I don't know where it got lost. Sorry if I submit this twice, I have never participated in a news group before.*
I am trying to set up a background queue for sending email as described in the web2py book. http://web2py.com/books/default/chapter/29/8#Sending-messages-using-a-background-task However, emails are only sent when they have been in the database before starting the script. Emails I add to the database when the queue is running do not get picked up for some reason. I got it to work by adding an additional db.commit() before the select() in every loop run. I assume this should not be needed. Does anyone have an idea why this is not working without that additional commit? import time while True: db.commit() # not working without this line rows = db(db.queue.status=='pending').select() for row in rows: if mail.send(to=row.email, subject=row.subject, message=row.message): row.update_record(status='sent') else: row.update_record(status='failed') db.commit() time.sleep(60) # check every minute --