Skip to content

Commit

Permalink
Remove Exercism::TOUCHED_OPENSEARCH_INDEXES.each
Browse files Browse the repository at this point in the history
  • Loading branch information
iHiD committed Jan 23, 2025
1 parent b4d4ef4 commit 27cd1ae
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 9 deletions.
1 change: 0 additions & 1 deletion app/commands/document/sync_all_to_search_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def call
end

Exercism.opensearch_client.bulk(body:)
Exercism::TOUCHED_OPENSEARCH_INDEXES << Document::OPENSEARCH_INDEX if Rails.env.test?
end
end

Expand Down
1 change: 0 additions & 1 deletion app/commands/document/sync_to_search_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ def call
id: doc.id,
body: Document::CreateSearchIndexDocument.(doc)
)
Exercism::TOUCHED_OPENSEARCH_INDEXES << Document::OPENSEARCH_INDEX if Rails.env.test?
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def create_document!
id: representation.id,
body: Exercise::Representation::CreateSearchIndexDocument.(representation)
)
Exercism::TOUCHED_OPENSEARCH_INDEXES << Exercise::Representation::OPENSEARCH_INDEX if Rails.env.test?
end

def delete_document!
Expand Down
1 change: 0 additions & 1 deletion app/commands/solution/sync_all_to_search_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def call
end

Exercism.opensearch_client.bulk(body:)
Exercism::TOUCHED_OPENSEARCH_INDEXES << Solution::OPENSEARCH_INDEX if Rails.env.test?
end
end

Expand Down
1 change: 0 additions & 1 deletion app/commands/solution/sync_to_search_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def create_document!
id: solution.id,
body: Solution::CreateSearchIndexDocument.(solution)
)
Exercism::TOUCHED_OPENSEARCH_INDEXES << Solution::OPENSEARCH_INDEX if Rails.env.test?
end

def delete_document!
Expand Down
8 changes: 4 additions & 4 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def download_s3_file(bucket, key)
# OpenSearch Helpers #
######################
def stub_opensearch!
opensearch_client = mock
opensearch_client = Exercism.opensearch_client
Exercism.define_method(:opensearch_client) { opensearch_client }
end

Expand All @@ -327,9 +327,9 @@ def wait_for_opensearch_to_be_synced
perform_enqueued_jobs

# Force an index refresh to ensure there are no concurrent actions in the background
Exercism::TOUCHED_OPENSEARCH_INDEXES.each do |index|
Exercism.opensearch_client.indices.refresh(index:)
end
# Exercism::TOUCHED_OPENSEARCH_INDEXES.each do |index|
# Exercism.opensearch_client.indices.refresh(index:)
# end
end

def perform_enqueued_jobs_until_empty
Expand Down

0 comments on commit 27cd1ae

Please sign in to comment.