lib/kestrel/client.rb in kestrel-client-0.7.1 vs lib/kestrel/client.rb in kestrel-client-0.7.2
- old
+ new
@@ -123,12 +123,15 @@
# and an empty queue, so just return nil. our sticky server
# logic should eliminate piling on down servers
nil
end
- # nil result, force next get to jump from current server
- @counter = @gets_per_server unless val
+ # nil result without :close and :abort, force next get to jump from
+ # current server
+ if !val && @shuffle && !opts[:close] && !opts[:abort]
+ @counter = @gets_per_server
+ end
val
end
def flush(queue)
@@ -153,9 +156,10 @@
opts.replace(memcache_opts)
kestrel_opts
end
def shuffle_if_necessary!(key)
+ return unless @server_count > 1
# Don't reset servers on the first request:
# i.e. @counter == 0 && @current_queue == nil
if @shuffle &&
(@counter > 0 && key != @current_queue) ||
@counter >= @gets_per_server