Skip to content

Commit 812d556

Browse files
authored
Merge pull request #451 from splitio/mtk-pipeline
Added pipeline operation for mtks.
2 parents d7f1ea3 + ac26eea commit 812d556

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lib/splitclient-rb/cache/senders/impressions_adapter/redis_sender.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ def initialize(config)
1414
def record_uniques_key(uniques)
1515
return if uniques.nil? || uniques == {}
1616

17-
size = 0
18-
uniques.each do |key, value|
19-
size = @adapter.add_to_queue(unique_keys_key, { f: key, ks: value.to_a }.to_json)
17+
size = @adapter.redis.pipelined do |pipeline|
18+
uniques.each do |key, value|
19+
pipeline.rpush(unique_keys_key, { f: key, ks: value.to_a }.to_json)
20+
end
2021
end
2122

22-
@adapter.expire(unique_keys_key, EXPIRE_SECONDS) if uniques.length == size
23+
@adapter.expire(unique_keys_key, EXPIRE_SECONDS) if uniques.length == size.last
2324
rescue StandardError => e
2425
@config.log_found_exception(__method__.to_s, e)
2526
end

0 commit comments

Comments
 (0)