Commit 51b8a760 authored by Kerri Miller's avatar Kerri Miller

Migrate from #multi to #pipelined for performance

Under the hood, #multi uses #pipelined, and we don't care about the
minor differences that using the #multi transaction approach gets us, so
we pick up about 0.1 sec of performance on large-ish diff collections.
This is a minor improvement, but as this is more or less a straight
drop-in replacement, and we're already workign directly with redis-rb,
it seems worthwhile.
parent 4a98138f
......@@ -75,14 +75,14 @@ module Gitlab
#
def write_to_redis_hash(hash)
Gitlab::Redis::Cache.with do |redis|
redis.multi do |multi|
redis.pipelined do
hash.each do |diff_file_id, highlighted_diff_lines_hash|
multi.hset(key, diff_file_id, highlighted_diff_lines_hash.to_json)
redis.hset(key, diff_file_id, highlighted_diff_lines_hash.to_json)
end
# HSETs have to have their expiration date manually updated
#
multi.expire(key, EXPIRATION)
redis.expire(key, EXPIRATION)
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment