diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-26 21:07:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-26 21:07:52 +0000 |
commit | 03a70b84edfb86bc27f9234e1f1d157d3a33c555 (patch) | |
tree | d8df46fee3e5a97d3b9dbd7d2e69ccc9e3601de1 /lib | |
parent | 165beade336f9049f95db3944b1c5c00a1e952cf (diff) | |
download | gitlab-ce-03a70b84edfb86bc27f9234e1f1d157d3a33c555.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/import_export/json/streaming_serializer.rb | 10 | ||||
-rw-r--r-- | lib/gitlab/redis/wrapper.rb | 5 |
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/gitlab/import_export/json/streaming_serializer.rb b/lib/gitlab/import_export/json/streaming_serializer.rb index 04ca598ff5d..7f55a0a3821 100644 --- a/lib/gitlab/import_export/json/streaming_serializer.rb +++ b/lib/gitlab/import_export/json/streaming_serializer.rb @@ -69,11 +69,13 @@ module Gitlab end def serialize_many_each(key, records, options) - records.each do |record| - json = Raw.new(record.to_json(options)) - - json_writer.append(key, json) + enumerator = Enumerator.new do |items| + records.each do |record| + items << Raw.new(record.to_json(options)) + end end + + json_writer.write_relation_array(@exportable_path, key, enumerator) end def serialize_single_relation(key, record, options) diff --git a/lib/gitlab/redis/wrapper.rb b/lib/gitlab/redis/wrapper.rb index c8932b26925..06ee81ba172 100644 --- a/lib/gitlab/redis/wrapper.rb +++ b/lib/gitlab/redis/wrapper.rb @@ -15,8 +15,11 @@ module Gitlab delegate :params, :url, to: :new def with + pool.with { |redis| yield redis } + end + + def pool @pool ||= ConnectionPool.new(size: pool_size) { ::Redis.new(params) } - @pool.with { |redis| yield redis } end def pool_size |