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
2b2cdfdc
Commit
2b2cdfdc
authored
Feb 17, 2021
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'disable-etag-caching-for-notes' into 'master'"
This reverts merge request !52765
parent
4c793ecd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
+14
-7
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
+1
-3
spec/requests/projects/noteable_notes_spec.rb
spec/requests/projects/noteable_notes_spec.rb
+10
-1
No files found.
app/controllers/concerns/notes_actions.rb
View file @
2b2cdfdc
...
...
@@ -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
]
#
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
)
#
Only present an ETag for the empty response to ensure pagination works
#
as expected
::
Gitlab
::
EtagCaching
::
Middleware
.
skip!
(
response
)
if
notes
.
present?
render
json:
meta
.
merge
(
notes:
notes
)
end
...
...
spec/controllers/projects/notes_controller_spec.rb
View file @
2b2cdfdc
...
...
@@ -150,7 +150,7 @@ RSpec.describe Projects::NotesController do
end
it
'returns an empty page of notes'
do
expect
(
Gitlab
::
EtagCaching
::
Middleware
).
to
receive
(
:skip!
)
expect
(
Gitlab
::
EtagCaching
::
Middleware
).
not_
to
receive
(
:skip!
)
request
.
headers
[
'X-Last-Fetched-At'
]
=
microseconds
(
Time
.
zone
.
now
)
...
...
@@ -169,8 +169,6 @@ 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 @
2b2cdfdc
...
...
@@ -18,7 +18,9 @@ RSpec.describe 'Project noteable notes' do
login_as
(
user
)
end
it
'does not set a Gitlab::EtagCaching ETag'
do
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
)
get
notes_path
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
...
@@ -27,5 +29,12 @@ 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