On Monday, January 25, 2021 at 9:22:08 PM UTC-8 Dave S wrote: > On Tuesday, January 19, 2021 at 10:19:38 PM UTC-8 veron.p...@gmail.com > wrote: > >> Hello, >> >> here is my problem : lets' assume that i connect to the following URL : >> >> http://mysite/myapp/default/myfunc/param >> >> and that the myfunc function in default.py makes a call to a function >> f(param) which could take a long time depending on the value of param. I >> wan't to stop my function f() if it's time execution exceeds 3 seconds. In >> that case i wan't to send a flash message which contains the message "Time >> limit exceeded" >> >> > Would it be better to use the scheduler? One of its purposes is to deal > with long-running processes without holding up the response to the user. > The work flow might be to have myfunc queue a worker and pass param to it, > return a "pending result" to the user, and then use jquery and a > client-side timer to poll for results. >
You may also be able to have the worker do a push notification of the results, but that's not any area I have experience with. > > Can you help me. I tried to use SIGALRM but wsgi does not allow to trap >> signals. I changed the default option in wsgi to catch SIGALRM but the i >> have an error which says that the signal function can only be used in the >> main thread which is the restricted.py script in gluon directory. Do i need >> to modify this script ? >> >> Thanks for your help >> > > Browsers have been known to give timeout messages of some sort if the > server takes too long. > > /dps -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/8bd5d920-b712-4361-b42c-771e87afc960n%40googlegroups.com.