On 14/02/2015, at 9:11 PM, Paul Royik <[email protected]> wrote:

> Sorry.
> 
> On localhost without mod_wsgi. 
> On server it doesn't raise an error on timeout and consumed nearly gigabyte 
> of memory.
> 
> 
> Anyway, I'm planning to use your way.
> Just wanted to ask. You wrote func.info = threading.local(). Why do we need 
> it? Why can't we just write func.end_time = time.time().... ?

Because the server is multithreaded and can handle concurrent web requests in 
the same process.

You can't have a single global end time as a subsequent request will come in 
and overwrite it. So if the first request hadn't finished, its end time would 
get reset to whatever was set for the later request.

The threading.local() means that each thread handling requests has its own copy 
of the end_time variable and so concurrent requests will not interfere with 
each other.

Graham

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to