search_index_associations_job.rb 492 B

123456789101112131415
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class SearchIndexAssociationsJob < SearchIndexJob
  3. def update_search_index(record)
  4. super
  5. updates = record.search_index_update_associations
  6. return true if updates.nil?
  7. return true if updates.all? { |update| update['total'].zero? }
  8. # reschedule job if there are more batches needed to update all objects
  9. self.class.set(wait: 1.second).perform_later(record.class.to_s, record.id)
  10. end
  11. end