kiqstand icon indicating copy to clipboard operation
kiqstand copied to clipboard

Gets rid of disconnecting sessions as that is going to happen anyway sin...

Open jonhyman opened this issue 11 years ago • 3 comments

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

jonhyman avatar Dec 09 '13 19:12 jonhyman

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

arthurnn avatar Dec 20 '13 21:12 arthurnn

@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

rgabo avatar Jun 18 '14 12:06 rgabo

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?

joe1chen avatar Oct 02 '14 16:10 joe1chen