Skip to content

Conversation

@jonhyman
Copy link

@jonhyman jonhyman commented Dec 9, 2013

...ce the session is stored on Fiber-local variables. Adds a note about how to reuse connections.

…since the session is stored on Fiber-local variables. Adds a note about how to reuse connections.
@arthurnn
Copy link
Contributor

[ref https://github.com/mongoid/mongoid-site/pull/236]

@rgabo
Copy link

rgabo commented Jun 18, 2014

@jonhyman thanks for taking the time to fork and submit the pull request, we've merged it in our own fork and are using the Celluloid::Thread patch to keep the connections per thread around.

@durran could kiqstand include the functionality? Using it could be optional for those who understand the implications, we're already doing this in a less invasive way:

config/initializers/sidekiq.rb

Sidekiq.configure_server do |config|
  config.server_middleware do |chain|
    # NOTE: Uses Kiqstand fork to clear IdentityMap without disconnecting
    # See: http://blog.appsignal.com/blog/2014/03/31/mongodb-mongoid-and-sideiq-connection-problems.html and https://github.com/mongoid/kiqstand/pull/10
    chain.add Kiqstand::Middleware
  end
end

module Celluloid
  class Thread < ::Thread
    include Project::Extensions::Celluloid::Thread
  end
end

@joe1chen
Copy link

joe1chen commented Oct 2, 2014

For JRuby, instead of the Celluloid patch, we're thinking of using the mongoid_connection_pool gem (https://github.com/cpuguy83/mongoid_connection_pool) from @cpuguy83. This gem takes care of the session issue.

If we use the connection pool gem, is it still required to clear the identity map separately in another Sidekiq middleware?

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

Successfully merging this pull request may close these issues.

4 participants