-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Another fetchbatched fix #2
Conversation
Thinking about releasing this as 2.0.0 because of the breaking change on that method, but maybe that's not how semver works. Anyone with better insight on that? |
@tehpsalmist if you include the words "BREAKING CHANGE" in one of your commits, then the release script will know to do a major version bump - https://github.com/conventional-changelog/standard-version#commit-message-convention-at-a-glance |
Thanks for the tip! So I guess you agree then that this should be a 2.0.0 release? |
@tehpsalmist whats your use case for fetchBatchPaginated? |
Since custom dev is going to start making heavy use of jobs/batching, the idea is that we can pull the records in a way that's already setup to create all the job's batches without having to recalc and split all the records into usable chunks. |
ah makes sense thanks @tedkulp |
What will it take to see this merged? I'm all ears. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
Thanks y'all. @AParks I'll get some concurrency in those requests eventually, I promise. |
This introduces a breaking change to the
fetchBatched
method, in that the second param will be a fullparams
object (which can included a filter, of course), instead of only a filter object. This allows the developer to customize important params like limit, attributes, and filter params (e.g.not-field123
,contains-string
, etc).Another method was also added:
fetchBatchedPaginated
, which mirrorsfetchBatched
except that the return value will be wrapped in an Array, and each item in that Array will correspond to a page of data (also an Array), the length of which is defined by thelimit
param.For both methods, if the
limit
param provided is not a valid number for that resource, the correctedlimit
that will be returned from Zengine is used to complete the rest of the recursive data-gathering, to ensure that each page is equal in length (except the last one) and all records are accurately obtained from the API.One final note on the implementation: previously the
fetchBatched
method relied onPromise.all
to get the remaining pages, but that is not very API friendly for large datasets, so the recursive pattern was used instead.