Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
AO3-5207 Add StatCounterIndexer and fix order of reindexing. #3111
Conversation
tickinginstant
added some commits
Oct 21, 2017
| @@ -35,6 +35,11 @@ def enqueue | ||
| end | ||
| def run | ||
| + # Do this before the old indexing to make sure that we know which IDs to | ||
| + # pass to the indexer. (Delete this comment after the upgrade is complete.) | ||
| + if $rollout.active?(:start_new_indexing) |
| @@ -0,0 +1,56 @@ | ||
| +# A class for reindexing work stats. |
| + end | ||
| + | ||
| + def index_documents | ||
| + $new_elasticsearch.bulk(body: batch) |
| @@ -32,4 +32,51 @@ | ||
| expect(IndexQueue::REDIS.exists("index:work:main")).to be_falsey | ||
| end | ||
| + | ||
| + describe "#run" do |
| @@ -0,0 +1,60 @@ | ||
| +require 'spec_helper' |
| @@ -0,0 +1,60 @@ | ||
| +require 'spec_helper' | ||
| + | ||
| +describe StatCounterIndexer do |
| + let!(:work) { create(:work, title: "unique title", posted: true) } | ||
| + let!(:stat_counter) { work.stat_counter } | ||
| + | ||
| + describe "#index_documents" do |
| + end | ||
| + | ||
| + it "should not change the search results for title" do | ||
| + expect do |
houndci-bot
Oct 22, 2017
Parenthesize the param change { result_count(title: "unique title") } to make sure that the block will be associated with the change method call.
| @@ -168,6 +168,10 @@ def update_and_refresh_indexes(klass_name) | ||
| $new_elasticsearch.indices.refresh(index: "ao3_test_#{klass_name}s") | ||
| end | ||
| +def refresh_index_without_updating(klass_name) | ||
| + $new_elasticsearch.indices.refresh(index: "ao3_test_#{klass_name}s") |
elzj
added
Awaiting review
Priority: Broken on Test (High)
labels
Oct 22, 2017
elzj
merged commit cc2e7e8
into
otwcode:master
Oct 22, 2017
added a commit
that referenced
this pull request
Nov 27, 2017
added a commit
that referenced
this pull request
Nov 27, 2017
added a commit
that referenced
this pull request
Nov 30, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tickinginstant commentedOct 22, 2017
Issue
https://otwarchive.atlassian.net/browse/AO3-5207
Purpose
The purpose of this pull request is twofold:
Fix an issue that occurs when :start_new_indexing is active, and :stop_old_indexing is not. Because the old indexing code deletes all of the indices in the subqueue after performing reindexing, the new indexing code was being run on the empty list, which was causing an error. (And also meant that nothing was being reindexed with the new system.)
Add in a StatCounterIndexer class so that the new indexing code can perform a stats-only update like the old indexing code, rather than having to reindex the whole work just to update the hit count.
Testing
Check to make sure that the ScheduledReindexJobs are being run without generating error messages.