I think you can, but how is this related to web2py? I mean, you can even run gevent inside a function in a controller if you want. Like in the example, if you have an action that needs to check if three URLs are available, it will return faster if you query those URLs asynchronously (using gevent, or asyncio, or Twisted, etc.)
El jueves, 1 de marzo de 2018, 13:04:35 (UTC-3), Pierre escribió: > > Hi, > > Can I use* gevent* to build a homemade redis task queue and to execute > these tasks? Does it make sense ? sorry if this is naiv questions i'm new > to async programming....... > > > http://web2py.com/books/default/chapter/29/08/emails-and-sms?search=homemade > > > from http://www.gevent.org/intro.html: > > > The following example shows how to run tasks concurrently: > > > >>> import gevent>>> from gevent import socket>>> urls = ['www.google.com', > >>> 'www.example.com', 'www.python.org']>>> jobs = > >>> [gevent.spawn(socket.gethostbyname, url) for url in urls]>>> > >>> gevent.joinall(jobs, timeout=2)>>> [job.value for job in > >>> jobs]['220.127.116.11', '18.104.22.168', '22.214.171.124' > > -- 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/d/optout.