#103 ✓resolved
Andrew

ПРОГОН ВАШЕГО РЕСУРСА ХРУМЕРОМ XRumer 12.0.9

Reported by Andrew | March 24th, 2010 @ 10:47 PM | in Bugs

Hey Mat,

So after I fixed my configuration file to work as outlined in ticket 102. I ran into another separate issue with how master/slave sessions are being used.

So the issue is that the gem will either always read/write from the master or always read/write from the slave. It will always read/write from the master if the first method you call is a index (or any other method directed at the master session). And it will always read/write from the slave if the first method you call is a search method.

I had a look through the code and this seems to be caused by the sunspot session being saved in the current Thread in the ThreadLocalSessionProxy.

  def session #:nodoc:
    Thread.current[:sunspot_session] ||= Session.new(config)
  end

So for the current thread, regardless of if the current ThreadLocalSessionProxy was created for the master or slave, we will always retrieve the first session that was stored.

Now I haven't submitted a patch for this because I wasn't sure the best way to fix the issue.

For those people with the same problem looking for a quickfix, I have just done this in my rails initializers, as a quick workaround for the moment. This will obviously take out the threading aspect of the code but, it works for me, for the moment.

module Sunspot
module SessionProxy

class ThreadLocalSessionProxy
  def session
     Session.new(config)
   end
end

end end

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Awesome Solr interaction for Ruby

Referenced by

Pages