Fix initial ingestion failing due to Intercom API timeouts #1044
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note:⚠️ This is only a mitigation for now but I believe we should be revisiting the criteria we use for initially retrieving (at install time) the closed conversations from Intercom. Maybe by adding a filter to search for conversations that were closed in the last 30 days or similar to help optimize the search query instead of the broader criteria we use right now.
Alternatively we could allow customers in the integration configuration screen specify a query that could help filters the ones they are really interested in using for ingestion.
This PR addresses Intercom API timeouts occurring during the initial fetch of closed conversations.
Currently, we request 100 items per page, which causes each search call to take around 18 seconds. After fetching about 5–6 pages, the API begins timing out:
To mitigate these timeouts, this PR reduces the number of conversations fetched per page, bringing the latency per search call down to 6–8 seconds:
Note: Since we previously fixed worker execution timeouts in #1025, by offloading parts of the workload (e.g. fetching conversation details, processing ~700 conversations, and ingestion) into batched task executions, we should now be in a good position regarding Intercom API rate limits.