Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Connection times out after 60 seconds when connection is idle #9

Open
phuesler opened this issue May 19, 2014 · 0 comments
Open

Connection times out after 60 seconds when connection is idle #9

phuesler opened this issue May 19, 2014 · 0 comments

Comments

@phuesler
Copy link

I could not find the place to change this timeout. Any pointers? Also, is there a way to check if there is still an active connection/tcp socket without going through a whole roundtrip (eg.g DataMapper::Repository.adapter.connection.alive?)?

This behavior is causing problems in combination with forked processes (e.g Resque workers). If the connection of the workers parents is no longer available, the child will open and close a connection for every item it processes. An ugly quick fix around this is to have the following in the workers master process (after_prefork hook):

   Thread.new do
      while true
        DataMapper::Repository.adapters.keys.each do |repo|
          DataMapper.repository(repo).adapter.select("SELECT 1;")
        end
        sleep 30
      end
    end
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant