diff --git a/app/jobs/search_index_associations_job.rb b/app/jobs/search_index_associations_job.rb index c9a7e84b1..d54aa49a2 100644 --- a/app/jobs/search_index_associations_job.rb +++ b/app/jobs/search_index_associations_job.rb @@ -1,6 +1,7 @@ class SearchIndexAssociationsJob < SearchIndexJob def update_search_index(record) + super record.search_index_update_associations_delta record.search_index_update_associations_full end diff --git a/app/models/concerns/has_search_index_backend.rb b/app/models/concerns/has_search_index_backend.rb index dd87155a8..a280028d9 100644 --- a/app/models/concerns/has_search_index_backend.rb +++ b/app/models/concerns/has_search_index_backend.rb @@ -24,7 +24,6 @@ update search index, if configured - will be executed automatically # start background job to transfer data to search index return true if !SearchIndexBackend.enabled? - SearchIndexJob.perform_later(self.class.to_s, id) SearchIndexAssociationsJob.perform_later(self.class.to_s, id) true end diff --git a/spec/models/concerns/has_search_index_backend_examples.rb b/spec/models/concerns/has_search_index_backend_examples.rb index eb3aab17b..7aaa05ae1 100644 --- a/spec/models/concerns/has_search_index_backend_examples.rb +++ b/spec/models/concerns/has_search_index_backend_examples.rb @@ -14,13 +14,13 @@ RSpec.shared_examples 'HasSearchIndexBackend' do |indexed_factory:| end it 'indexes on create' do - expect(SearchIndexJob).to have_been_enqueued + expect(SearchIndexAssociationsJob).to have_been_enqueued end it 'indexes on update' do clear_jobs subject.update(note: 'Updated') - expect(SearchIndexJob).to have_been_enqueued + expect(SearchIndexAssociationsJob).to have_been_enqueued end it 'indexes on touch' do diff --git a/spec/requests/integration/monitoring_spec.rb b/spec/requests/integration/monitoring_spec.rb index 9d4cab116..3bcf66629 100644 --- a/spec/requests/integration/monitoring_spec.rb +++ b/spec/requests/integration/monitoring_spec.rb @@ -610,7 +610,7 @@ RSpec.describe 'Monitoring', type: :request do expect(json_response['message']).to be_truthy expect(json_response['issues']).to be_truthy expect(json_response['healthy']).to eq(false) - expect( json_response['message']).to eq("Failed to run background job #1 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).;Failed to run background job #2 'SearchIndexJob' 1 time(s) with 1 attempt(s).") + expect( json_response['message']).to eq("Failed to run background job #1 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).") # add another job manual_added = SearchIndexJob.perform_later('Ticket', 1) @@ -624,7 +624,7 @@ RSpec.describe 'Monitoring', type: :request do expect(json_response['message']).to be_truthy expect(json_response['issues']).to be_truthy expect(json_response['healthy']).to eq(false) - expect( json_response['message']).to eq("Failed to run background job #1 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).;Failed to run background job #2 'SearchIndexJob' 2 time(s) with 11 attempt(s).") + expect( json_response['message']).to eq("Failed to run background job #1 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).;Failed to run background job #2 'SearchIndexJob' 1 time(s) with 10 attempt(s).") # add another job dummy_class = Class.new(ApplicationJob) do @@ -645,7 +645,7 @@ RSpec.describe 'Monitoring', type: :request do expect(json_response['message']).to be_truthy expect(json_response['issues']).to be_truthy expect(json_response['healthy']).to eq(false) - expect(json_response['message']).to eq("Failed to run background job #1 'Object' 1 time(s) with 5 attempt(s).;Failed to run background job #2 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).;Failed to run background job #3 'SearchIndexJob' 2 time(s) with 11 attempt(s).") + expect(json_response['message']).to eq("Failed to run background job #1 'Object' 1 time(s) with 5 attempt(s).;Failed to run background job #2 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).;Failed to run background job #3 'SearchIndexJob' 1 time(s) with 10 attempt(s).") # reset settings Setting.set('es_url', prev_es_config) @@ -664,7 +664,7 @@ RSpec.describe 'Monitoring', type: :request do expect(json_response['message']).to be_truthy expect(json_response['issues']).to be_truthy expect(json_response['healthy']).to eq(false) - expect(json_response['message']).to eq("14 failing background jobs;Failed to run background job #1 'Object' 7 time(s) with 35 attempt(s).;Failed to run background job #2 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).;Failed to run background job #3 'SearchIndexJob' 2 time(s) with 11 attempt(s).") + expect(json_response['message']).to eq("13 failing background jobs;Failed to run background job #1 'Object' 8 time(s) with 40 attempt(s).;Failed to run background job #2 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).;Failed to run background job #3 'SearchIndexJob' 1 time(s) with 10 attempt(s).") # cleanup Delayed::Job.delete_all