Closed ppanero closed 2 years ago
By indexing before committing, you'll just end up with another problem with records appearing in the index but not in the database so I'm not sure this is a good idea
clearly not a good idea 😅, DB should be the "source of truth". The only thing would be to report the indexing fails (which should happen anyway via sentry since there will be an exception)
Currently the creation of the record in the DB is committed before the indexing happens:
Source: https://github.com/inveniosoftware/invenio-records-rest/blob/master/invenio_records_rest/views.py#L601
Since the result of the indexing is not checked if for some reason Elasticsearch/Whatever other custom indexer fails to do so the record would be in the database already (which is not communicated to the user).
Should this be taken care of here? Or in an error handler?