To improve performance of the db sync receiver, the calls to rebuild the search index need to be made separately, this ensures that failure of the operation does not result in adding the item to the error queue since the incoming entity changes are already applied to the database.
- Add a special error handler for the route that rebuilds the search index
- Add a new database table named receiver_search_index_rebuild_request for storing re-indexing operations and the dbsync route should not call the search index route directly anymore, alternatively we only insert into this table when we need to rebuild the index for an entire entity type otherwise for a single entity directly call search index rebuild route synchronously
- Whenever an indexed entity is received we add a row to the receiver_search_index_rebuild_request table
- Add a new route that polls and processes rows in the receiver_search_index_rebuild_request table and rebuilds the search index for each entry