diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-07-21 20:13:10 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-07-21 20:13:10 +0000 |
commit | d1682ef36da83e3f0625bce760810bdde8efec51 (patch) | |
tree | ae0a2c73c4d3fa9373fbd31bb76b2cf26951cabf /spec | |
parent | 3f03699e971b513ecf2bee5a91cf4149cdc122e6 (diff) | |
parent | 0c14c6332d38704a7bfd8916a8deedd5c5808978 (diff) | |
download | gitlab-ce-d1682ef36da83e3f0625bce760810bdde8efec51.tar.gz |
Merge branch 'fix/get-cached-rendered-html-using-single-redis-request' into 'master'
Retrieve rendered HTML from cache in one request
## What does this MR do?
It consolidates requests made to cache store to check for cached HTML of multiple Markdown texts (for reference extracting purposes) into one request.
## Are there points in the code the reviewer needs to double check?
N/A
## Why was this MR needed?
To improve the performance of `Participable#raw_participants`
## What are the relevant issue numbers?
#19985
## Screenshots (if relevant)
N/A
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- ~~[ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- ~~[ ] API support added~~
- ~~Tests~~
- ~~[ ] Added for this feature/bug~~
- ~~[ ] All builds are passing~~
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !5406
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/note_spec.rb | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 7d0697dab42..1243f5420a7 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -135,22 +135,30 @@ describe Note, models: true do let!(:note2) { create(:note_on_issue) } it "reads the rendered note body from the cache" do - expect(Banzai::Renderer).to receive(:render). - with(note1.note, - pipeline: :note, - cache_key: [note1, "note"], - project: note1.project, - author: note1.author) - - expect(Banzai::Renderer).to receive(:render). - with(note2.note, - pipeline: :note, - cache_key: [note2, "note"], - project: note2.project, - author: note2.author) - - note1.all_references - note2.all_references + expect(Banzai::Renderer).to receive(:cache_collection_render). + with([{ + text: note1.note, + context: { + pipeline: :note, + cache_key: [note1, "note"], + project: note1.project, + author: note1.author + } + }]).and_call_original + + expect(Banzai::Renderer).to receive(:cache_collection_render). + with([{ + text: note2.note, + context: { + pipeline: :note, + cache_key: [note2, "note"], + project: note2.project, + author: note2.author + } + }]).and_call_original + + note1.all_references.users + note2.all_references.users end end |