Wait, are we still using .repl to connect to RethinkDB? Ugh. That's my bad. I've talked extensively to the people at rethink since we wrote that part -- .repl shouldn't be used for this type of scenario. It is appropriate to connect each time, but using a normal connection, not a REPL one. I can fix that tomorrow. I have example code in another project I can use. 

Tim

> On Mar 17, 2014, at 1:11 AM, Darren Cauthon <notifications@github.com> wrote:
> 
> In lib/kilt/utils.rb:
> 
> > @@ -37,10 +37,12 @@ def self.setup_db
> >      
> >      # Make a db call
> >      def self.db(&block)
> > -      db = r.connect(:host => Kilt.config.db.host, :port => Kilt.config.db.port).repl
> > -      results = block.call()
> > -      db.close
> > -      results
> > +      @db ||= r.connect(:host => Kilt.config.db.host, :port => Kilt.config.db.port).repl
> Using a single database connection object for everything, versus continually creating new connections, seems to have resolved the socket errors I was getting while running the tests.
> 
> —
> Reply to this email directly or view it on GitHub.