Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/redrate/ring.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def current
def rotate!
current_head = head
current_time = now
@redis.pipelined do
@redis.lset(ring_key, current_head, current_time.to_s)
@redis.set(head_key, (current_head + 1) % @size)
@redis.pipelined do |pipeline|
pipeline.lset(ring_key, current_head, current_time.to_s)
pipeline.set(head_key, (current_head + 1) % @size)
end
end

Expand Down Expand Up @@ -70,11 +70,11 @@ def key_for(thing)
def initialize_ring
return unless @redis.llen(ring_key).zero?

@redis.pipelined do
@redis.pipelined do |pipeline|
1.upto(@size) do
@redis.lpush(ring_key, @default)
pipeline.lpush(ring_key, @default)
end
@redis.set(head_key, 0)
pipeline.set(head_key, 0)
end
end

Expand Down