Making asynchronous request in web2py

81 views
Skip to first unread message

Adi

unread,
Sep 9, 2010, 7:05:49 AM9/9/10
to web2py-users
Hi,

I have this test case:

1. User registers in app.
2. App sends him greeting email ("Welcome to so-and-so app").
3. App adds his email/name etc to mailing application (like Mailchimp)
for auto-subscribing to newsletter.

Now user expects steps 1 completion to take him to the next 'default/
index' page, and we don't want steps 2 and 3 to prevent completion of
step 1. Is there a way to make step 2 and 3 complete independently, in
a way that user's experience is not slowed down?

Think of it as being equivalent of asynchronous ajax request, which
doesn't wait for response before moving to the next piece of
javascript.

Any help on this? I know we should not create threads because web2py
handles that for us (read in some older post long long ago).

-- Adi

Michael Ellis

unread,
Sep 9, 2010, 5:16:17 PM9/9/10
to web2py-users
Others may have more experience with this, but it sounds like your
example could be handled with a cron job that periodically checks for
newly registered users. On GAE, you also have the option to use a
task queue.

mdipierro

unread,
Sep 9, 2010, 5:50:56 PM9/9/10
to web2py-users

Adi

unread,
Sep 10, 2010, 1:29:00 AM9/10/10
to web2py-users
Question: Will the function "lola" execute in a different thread or
something?

Adi

unread,
Sep 10, 2010, 1:29:59 AM9/10/10
to web2py-users
Want to avoid cron. Crons need to run in a separate web2py instance,
and there are some issues we've faced in keeping that alive and
running without memory issues.

-- Aditya

mdipierro

unread,
Sep 10, 2010, 8:42:30 AM9/10/10
to web2py-users
No. It is executed inside auth
Reply all
Reply to author
Forward
0 new messages