On Oct 10, 2014, at 11:41 AM, Mike Bayer <mba...@redhat.com> wrote:

> I’ve been asking a lot about “hey are people cool with thread locals?” and 
> have been waiting for what the concerns are.    
> Since I wrote that email I’ve shifted, and I’ve been considering only:
> @sql.reader
> def my_api_method(context, …):
>   context.session
> def my_api_method(context, …):
>  with sql.using_reader(context) as session:
>    session , context.session
> because in fact, if you *want* to use a thread local context, you can, 
> explicitly with the above:
> GLOBAL_CONTEXT = threading.local()
> def my_api_method(…):
>  with sql.using_reader(GLOBAL_CONTEXT) as session:
>    session 
> I like that one the best.  But again, Keystone folks would need to accept 
> this explicitness.
> The challenge on my end is not technical in any way.  It’s getting every 
> project to agree on a single approach and not getting bogged down with 
> idealistics (like, “let’s build a dependency injection framework!”).    
> Because this “everyone does it their own way” thing is crazy and has to stop.

I’ve now pushed these changes, as well as a summation of all the alternatives 
so far, to the latest release.  See https://review.openstack.org/#/c/125181/.

OpenStack-dev mailing list

Reply via email to