Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
28287bda
Commit
28287bda
authored
Feb 14, 2022
by
Robert May
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable JSON limited encoder
Changelog: performance
parent
f536b8cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
20 deletions
+0
-20
config/feature_flags/development/json_limited_encoder.yml
config/feature_flags/development/json_limited_encoder.yml
+0
-8
lib/gitlab/json.rb
lib/gitlab/json.rb
+0
-2
spec/lib/gitlab/json_spec.rb
spec/lib/gitlab/json_spec.rb
+0
-10
No files found.
config/feature_flags/development/json_limited_encoder.yml
deleted
100644 → 0
View file @
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
lib/gitlab/json.rb
View file @
28287bda
...
@@ -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
...
...
spec/lib/gitlab/json_spec.rb
View file @
28287bda
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment