Commit 28287bda authored by Robert May's avatar Robert May

Enable JSON limited encoder

Changelog: performance
parent f536b8cd
---
name: json_limited_encoder
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38687
rollout_issue_url:
milestone: '13.3'
type: development
group: group::source code
default_enabled: true
...@@ -248,8 +248,6 @@ module Gitlab ...@@ -248,8 +248,6 @@ module Gitlab
# @return [String] # @return [String]
# @raise [LimitExceeded] if the resulting json string is bigger than the specified limit # @raise [LimitExceeded] if the resulting json string is bigger than the specified limit
def self.encode(object, limit: 25.megabytes) def self.encode(object, limit: 25.megabytes)
return ::Gitlab::Json.dump(object) unless Feature.enabled?(:json_limited_encoder, default_enabled: :yaml)
buffer = StringIO.new buffer = StringIO.new
buffer_size = 0 buffer_size = 0
......
...@@ -440,15 +440,5 @@ RSpec.describe Gitlab::Json do ...@@ -440,15 +440,5 @@ RSpec.describe Gitlab::Json do
expect(subject.size).to eq(10001) expect(subject.size).to eq(10001)
end end
end end
context 'when json_limited_encoder is disabled' do
let(:obj) { [{ test: true }] * 1000 }
it 'does not raise an error' do
stub_feature_flags(json_limited_encoder: false)
expect { subject }.not_to raise_error
end
end
end 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