> +    require 'lib/puppet/rails/activerecord_connections' # Patch for #3238

This shouldn't have the 'lib/'

Also, this looks like something that should go into
puppet/util/monkey_patches except (I'm assuming) we don't want it
unless rails is in use so we may have loading order issues.

> diff --git a/lib/puppet/rails/activerecord_connections.rb 
> b/lib/puppet/rails/activerecord_connections.rb
> new file mode 100644
> index 0000000..6281180
> --- /dev/null
> +++ b/lib/puppet/rails/activerecord_connections.rb
> @@ -0,0 +1,50 @@
> +module ActiveRecord
> +  module ConnectionAdapters
> +    class ConnectionPool
> +      def cleanup_connection
> +        return yield if Thread.current[:__AR__cleanup_connection]
> +
> +        begin
> +          Thread.current[:__AR__cleanup_connection] = true
> +          yield
> +        ensure
> +          release_connection
> +          Thread.current[:__AR__cleanup_connection] = false
> +        end
> +      end
> +    end
> +  end
> +end

This isn't thread safe, if that's the intent; you could pass the first
test in two threads at once and then they'd both set it to true...

-- M
-----------------------------------------------------------
The power of accurate observation is
commonly called cynicism by those
who have not got it.  ~George Bernard Shaw
------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to