Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What does generally cause the "Dropped db cursor" error? #79

Open
pedrovinicius opened this issue Jun 11, 2018 · 0 comments
Open

What does generally cause the "Dropped db cursor" error? #79

pedrovinicius opened this issue Jun 11, 2018 · 0 comments

Comments

@pedrovinicius
Copy link

pedrovinicius commented Jun 11, 2018

I'm using this gem in production alongside with Sinatra and Puma. Puma is running with 2 workers.

My code for database queries is identical to the following snippet:

database_connections =  YAML.load_file('./databases_list.yml')

def iterate_over_servers(&block)
  database_connections.each do |conection_info|
    conn = ActiveRecord::Base.establish_connection(connection_info)

    yield conn
  end
end

iterate_over_servers do |connection|
  Person.where(name: '', email: '') #...
  connection.disconnect!
end

I have a list of identical databases (running on distinct servers) that I have to connect to and collect some data. But I'm suspecting I'm doing something terribly wrong, as when this code gets executed, the ruby interpreter raises a Dropped DB Cursor exception.

Do you have any idea of what can be possibly causing this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant