On Friday, November 6, 2015 at 2:15:33 PM UTC-5, Benson Myrtil wrote:
>
> Is there an easy way to detect if it is a worker making a request vs an 
> http request?
>

For now:

cmd_options = request.global_settings.cmd_options
if cmd_options and cmd_options.scheduler:
    [this is a worker running a scheduled task]

In trunk (but not yet in the current stable release):

if request.is_scheduler:

request.is_scheduler has been available for some time, but there was a bug 
that was only recently fixed, so it won't work until the next stable 
release.

Anthony

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to