Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make search sync asynchronous when merging orgs
There are two issues with search sync being synchronous right now: 1. It might take longer to sync to search than to execute a finalizing temporal workflow. If this happens, temporal workflow will notify frontend about finishing org merging before this method returns. This means, frontend learns about org merging being done before it learns the org merging even started. 2. Synchronous search sync might fail. Since we execute it outside of a database transaction, the error frontend sees will be misleading. Because, on one hand, the request to merge orgs failed, but on the other hand it actually did something, transaction got commited, it can't be retried. As a result, the solution: 1. Make search sync asynchronous, so it doesn't fail (or fails much less often) 2. Execute it before starting executing temporal workflow. So there is as little delay as possible between starting a temporal workflow and returning something to frontend
- Loading branch information