Pierre Baillet <[email protected]> wrote:
> Hello Unicorns,
> 
> I've manage to create a simple middleware that replaces the soft
> timeout feature. You can have a look at it at
> http://gist.github.com/431451
> 
> Note that some weird Ruby interpreter behavior breaks at least the
> first level of the generated stacktrace (it indicates the actual
> method where the raise happened but the wrong line number and file).

You should be able to avoid spawning a new thread for every request, as
that can get very expensive on some systems.  Maybe a global hash
guarded by a mutex that tells the worker Thread which thread to raise
on.  The worker thread could sleep until the next timeout registered.

But then again, take care to only spawn new threads in workers (with
preload_app=true), as threads never get carried across fork.  And
threads may leave mutexes and such in a bad state when they vanish
in the child.

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

Reply via email to