AO3-7284 Configurable indexer batch size#5589
Open
not-varram wants to merge 1 commit intootwcode:masterfrom
Open
AO3-7284 Configurable indexer batch size#5589not-varram wants to merge 1 commit intootwcode:masterfrom
not-varram wants to merge 1 commit intootwcode:masterfrom
Conversation
Bilka2
requested changes
Feb 28, 2026
Contributor
Bilka2
left a comment
There was a problem hiding this comment.
Thanks for working on this, I have a few comments
| # Job size used for the HitCountUpdateJob class: | ||
| HIT_COUNT_JOB_SIZE: 1000 | ||
|
|
||
| # Batch size used by Search::Indexer when reading records from the database: |
Contributor
There was a problem hiding this comment.
Suggested change
| # Batch size used by Search::Indexer when reading records from the database: | |
| # Batch size used by Indexer when reading records from the database: |
| end | ||
|
|
||
| def self.batch_size | ||
| ArchiveConfig.SEARCH_INDEXER_BATCH_SIZE || 1000 |
Contributor
There was a problem hiding this comment.
This is always set since it's in the config, so there's no reason to have a default here
| let(:indexables) { instance_double(ActiveRecord::Relation, count: 2) } | ||
|
|
||
| before do | ||
| stub_const("TestIndexer", Class.new(Indexer)) |
Contributor
There was a problem hiding this comment.
We don't normally stub like this, could you please work with less stubbing/mocking here? It would be better to actually make records and then index those, e.g. make a few works and then call the method on the WorkIndexer. Then the only thing you have to stub/mock is the AsyncIndexer, so you're interacting a lot less with the innards of the class you're testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
as the first thing in your pull request title (e.g.
AO3-1234 Fix thing)until they are reviewed and merged before creating new pull requests.
Issue
https://otwarchive.atlassian.net/browse/AO3-7284
Purpose
Make
Search::Indexerbatch size configurable viaconfig/config.ymlinstead of hardcoded.Testing Instructions
SEARCH_INDEXER_BATCH_SIZEinconfig/config.yml(default is1000).docker compose run --rm test bundle exec rspec spec/models/search/indexer_spec.rb spec/lib/tasks/search_tasks.rake_spec.rbdocker compose run --rm test bundle exec rake search:reindex_collectionsCredit
varram (he/him)