Yes, I think the use of queues in general needs to go way up. I use a very
simple queue for emailing:
===models.py===
db.define_table('mail_queue',
Field('status'),
Field('email'),
Field('subject'),
Field('message'))
===mail_queue.py===
import time
while True:
rows = db(db.mail_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
===crontab===
@reboot root *applications/init/private/mail_queue.py
The trick is to offload all the tasks into a queue and then have the web
page poll the app for completion via Ajax or something.
Massimo inquired about more built-in queuing functionality which is probably
not a bad idea since it's such a useful approach. Maybe it can reasonably be
delivered as a module.