Conversation
…ncurrent worker system The previous `_fetch_connected_account_ids` implementation was a single sequential paginator through GET `/v1/accounts`. For platforms with 36k+ connected accounts, this was taking over an hour. That's too slow since all connected account ids are fetched each time the capture starts up; we'd rather not spend an hour fetching connected account ids before capturing any data. This commit replaces that sequential paginator with a concurrent worker system modeled after `source-klaviyo-native`'s events backfill that partitions the time range into chunks using Stripe's `created[gte]`/`created[lte]` query parameters and has multiple workers paginate through their respective chunks in parallel. Workers detect dense time windows (chunks that take >30s to paginate) and, when idle workers are available, submit the remaining unprocessed range to a subdivision worker that splits it into smaller chunks for other workers to pick up.
Member
Author
|
Note: most of the CI checks failed due to an intermittent GitHub issue, but the one for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description:
The previous
_fetch_connected_account_idsimplementation was a single sequential paginator through GET/v1/accounts. For platforms with 36k+ connected accounts, this was taking over an hour. That's too slow since all connected account ids are fetched each time the capture starts up; we'd rather not spend an hour fetching connected account ids before capturing any data.This commit replaces that sequential paginator with a concurrent worker system modeled after
source-klaviyo-native's events backfill. The concurrent worker system partitions the time range into chunks using Stripe'screated[gte]/created[lte]query parameters and has multiple workers paginate through their respective chunks in parallel.Workers detect dense time windows (chunks that take >30s to paginate) and, when idle workers are available, submit the remaining unprocessed range to a subdivision worker that splits it into smaller chunks for other workers to pick up.
Notes for reviewers:
This is an isolated change that's a drop in replacement for how the connector fetches connected account ids. The very similar concurrent worker system in
source-klaviyo-nativehas been working well for multiple months, and I anticipate it'll work well insource-stripe-nativetoo to speed up fetching all connected account ids by at least 5x, likely more.