[Nitro] Request for Transaction example

Dan North dan at tastapod.com
Tue Jun 5 18:56:58 EDT 2007


You could steal a Java trick and associate a connection with the current 
thread when you begin a transaction. Then each call to $og.store.conn 
checks to see whether the current thread is in a transaction, and if so 
which connection is servicing it (basically a hash lookup of 
thread.__id__ to connection, defaulting to anything-from-the-pool).

When the connection is committed or rolled back, the association is 
broken so any further calls to $og.store.conn go back to the pool again.

But then I'm coming in halfway through this, so I might be way off :)

Cheers,
Dan


George Moschovitis wrote:
> Argh... this is very annoying indeed...
>
> unless anyone beats me and provides a patch (hint, hint) I will 
> resolve this tomorrow.
>
> -g.
>
> On 6/5/07, * Reid Thompson* <Reid.Thompson at ateb.com 
> <mailto:Reid.Thompson at ateb.com>> wrote:
>
>     On Tue, 2007-06-05 at 12:53 -0400, Reid Thompson wrote:
>
>     > > >
>     > >
>     > > so the default initialization starts 5 connections to the
>     database?
>     > > and we're utilizing 'more than one' in our scenario?
>     >
>     > OK -- I think I see...
>     > ./lib/og/manager.rb
>     > 66:      (options[:connection_count] || 5).times do
>
>     explicitly setting :connection_count => doesn't yield what I expected
>     either.... had thought that setting only one connection would
>     force all
>     transactions through that 1 and only connection...
>     _______________________________________________
>     Nitro-general mailing list
>     Nitro-general at rubyforge.org <mailto:Nitro-general at rubyforge.org>
>     http://rubyforge.org/mailman/listinfo/nitro-general
>
>
>
>
> -- 
> http://georgeandstella.com
> http://blog.gmosx.com <http://blog.gmosx.com>
> http://cull.gr
> http://www.joy.gr
> http://nitroproject.org
> ------------------------------------------------------------------------
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20070605/ca533664/attachment-0001.html 


More information about the Nitro-general mailing list