From: Jordan Ritter <firstname.lastname@example.org>
To: unicorn list <email@example.com>
Subject: Re: Thread.current
Date: Thu, 13 Jan 2011 08:46:23 -0800 [thread overview]
Message-ID: <28E5C7A1-2B77-4B90-AEE3-C2812A327366@darkridge.com> (raw)
For the record, the "clear the Thread.current storage before/after each request" is what I think is a crappy idiom. YMMV I guess.
On Jan 12, 2011, at 8:26 PM, Eric Wong wrote:
> Jimmy Soho <firstname.lastname@example.org> wrote:
>> Take for example activesupport's usage of Time.zone. Under water this
>> is set in a thread local var. If you set Time.zone in one request, but
>> not in the next request, using unicorn the next request will use the
>> time zone of the previous request. Using rack or mongrel (in
>> multithreaded mode) you don't have this issue perse (though they have
>> other issues then).
>> Same for the i18n gem and it's usage of the I18n.locale value, which
>> is also set in a thread local var.
>> So yeah, unfortunately I have to take into account this "crappy idiom"
>> and need to know exactly which thread local vars are set by all the
>> components we use, and determine which of those must be reset before
>> each request.
> You can probably just write a trivial middleware to clear all
> keys in Thread.current before every request. Or play around with
> Rainbows! with a single-threaded ThreadSpawn:
> cat >> unicorn.conf.rb <<EOF
> Rainbows! do
> use :ThreadSpawn
> worker_connections 1
> keepalive_timeout 0
> And then just run "rainbows" instead of "unicorn".
> Eric Wong
> Unicorn mailing list - email@example.com
> Do not quote signatures (like this one) or top post when replying
Unicorn mailing list - firstname.lastname@example.org
Do not quote signatures (like this one) or top post when replying
prev parent reply other threads:[~2011-01-13 16:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-08 2:00 Thread.current Jimmy Soho
2011-01-08 2:57 ` Thread.current Eric Wong
2011-01-08 3:09 ` Thread.current Curtis j Schofield
2011-01-08 5:54 ` Thread.current Jimmy Soho
2011-01-11 22:52 ` Thread.current Jimmy Soho
2011-01-11 23:12 ` Thread.current Eric Wong
2011-01-11 23:12 ` Thread.current Jordan Ritter
2011-01-12 3:07 ` Thread.current Jimmy Soho
2011-01-13 4:26 ` Thread.current Eric Wong
2011-01-13 16:46 ` Jordan Ritter [this message]
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
List information: https://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).