Hello guys,

I am trying to help with a web2py application (web2py v. 2.2.1, ancient, 
yes) that needs an urgent patch as follows:

There is a controller function that fetches all facebook friends of the 
user and stores them in the db (mysql). Currently this is done plainly in 
that function, during the request-response cycle, so the browser waits for 
the contacts import to happen and then gets the response. For people with 
many friends (thousands) this takes minutes, so uwsgi kills the python 
process.

I tried to resolve this in two different ways, neither worked so far:

(1) the controller function spawns a separate thread for the import and 
then let it run and return response. This kinda worked but importing does 
strange pauses every couple of seconds, (pausing for a random period, 
typically 2-6 seconds, sometimes longer). Don't know why that happens, but 
it makes the whole process unbearably slow.

(2) tried to spawn a separate process using multiprocessing, but import 
multiprocessing fails.

(3) Using the scheduler is another option, but I hesitate to go for it 
because of the ancient version of web2py.

(4) Another approach that comes to my mind is to somehow send the response 
but keep the thread of that response and do the job in that thread before 
letting it go.

What would you recommend me to do? This is an urgent issue, so any prompt 
help is much appreciated! Thanks!

Yassen

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to