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
27fdce1a
Commit
27fdce1a
authored
Feb 04, 2021
by
David Kim
Committed by
Sean McGivern
Feb 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable ETag caching on notes due to issues with pagination
parent
81628d41
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
14 deletions
+7
-14
app/controllers/concerns/notes_actions.rb
app/controllers/concerns/notes_actions.rb
+3
-3
spec/controllers/projects/notes_controller_spec.rb
spec/controllers/projects/notes_controller_spec.rb
+3
-1
spec/requests/projects/noteable_notes_spec.rb
spec/requests/projects/noteable_notes_spec.rb
+1
-10
No files found.
app/controllers/concerns/notes_actions.rb
View file @
27fdce1a
...
...
@@ -31,9 +31,9 @@ module NotesActions
# We know there's more data, so tell the frontend to poll again after 1ms
set_polling_interval_header
(
interval:
1
)
if
meta
[
:more
]
#
Only present an ETag for the empty response to ensure pagination works
#
as expected
::
Gitlab
::
EtagCaching
::
Middleware
.
skip!
(
response
)
if
notes
.
present?
#
We might still want to investigate further adjusting ETag caching with paginated notes, but
#
let's avoid ETag caching for now until we confirm the viability of paginated notes.
::
Gitlab
::
EtagCaching
::
Middleware
.
skip!
(
response
)
render
json:
meta
.
merge
(
notes:
notes
)
end
...
...
spec/controllers/projects/notes_controller_spec.rb
View file @
27fdce1a
...
...
@@ -150,7 +150,7 @@ RSpec.describe Projects::NotesController do
end
it
'returns an empty page of notes'
do
expect
(
Gitlab
::
EtagCaching
::
Middleware
).
not_
to
receive
(
:skip!
)
expect
(
Gitlab
::
EtagCaching
::
Middleware
).
to
receive
(
:skip!
)
request
.
headers
[
'X-Last-Fetched-At'
]
=
microseconds
(
Time
.
zone
.
now
)
...
...
@@ -169,6 +169,8 @@ RSpec.describe Projects::NotesController do
end
it
'returns all notes'
do
expect
(
Gitlab
::
EtagCaching
::
Middleware
).
to
receive
(
:skip!
)
get
:index
,
params:
request_params
expect
(
json_response
[
'notes'
].
count
).
to
eq
((
page_1
+
page_2
+
page_3
).
size
+
1
)
...
...
spec/requests/projects/noteable_notes_spec.rb
View file @
27fdce1a
...
...
@@ -18,9 +18,7 @@ RSpec.describe 'Project noteable notes' do
login_as
(
user
)
end
it
'does not set a Gitlab::EtagCaching ETag if there is a note'
do
create
(
:note_on_merge_request
,
noteable:
merge_request
,
project:
merge_request
.
project
)
it
'does not set a Gitlab::EtagCaching ETag'
do
get
notes_path
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
...
@@ -29,12 +27,5 @@ RSpec.describe 'Project noteable notes' do
# interfere with notes pagination
expect
(
response_etag
).
not_to
eq
(
stored_etag
)
end
it
'sets a Gitlab::EtagCaching ETag if there is no note'
do
get
notes_path
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response_etag
).
to
eq
(
stored_etag
)
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