-
Notifications
You must be signed in to change notification settings - Fork 187
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
PDE-5309 feat(core): add support for "buffered creates" #832
Conversation
[PDE-4989] feat(schema): Add support for bulk writes
…-check feat(core): add runtime check for performBulk
feat(core): Define types for performBulk
docs(cli): Add docs for bulk-write support
packages/cli/README.md
Outdated
}, | ||
}); | ||
|
||
// Create a matching result using the idempotency ID for each buffered invovation run. |
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.
invocation typo
|
||
BasicCreateActionOperationSchema.properties.buffer = { | ||
description: | ||
'Zapier uses this configuration for writing in bulk with `performBuffer`.', |
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.
We seldom use the word write/writing
on the schema, I want to double check if this is the intended word to use
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.
Good call! I've replaced "write" with "create" in several places I found.
}, | ||
limit: { | ||
description: | ||
"The maximum number of items to call `performBuffer` with. **Note** that it is capped by the platform to prevent exceeding the [AWS Lambda's request/response payload size quota of 6 MB](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html#function-configuration-deployment-and-execution). Also, the execution is time-bound; we recommend reducing it upon consistent timeout.", |
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.
Is this still relevant if we introduced this?
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.
It was written before we added supported for large response payloads. I think for response payloads, it's no longer relevant. But for request payloads, it's still relevant, so I think we should keep it.
}, | ||
}; | ||
|
||
describe('bufferedWriteConstraints', () => { |
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.
Do these usually include a happy path? 😅
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.
Sorry I'm not sure what you mean. Can you clarify?
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.
Ignore me, I thought I only saw test cases for all the various error paths, but didn't see a happy success path, but I see it now.
I reviewed bc it was referenced in the backend MR, but noticed this was still in draft, so did a quick pass through, lmk when this is ready! |
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.
Changes look great, thank you.
I wasn't able to test this on an integration (found issues upstream, likely an environment thing) but it looks like you tested at length in the demo, so I'm happy with that.
@standielpls thanks for the review! I added some text mentioning the feature is internal-only. Can you re-review? |
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.
I'll approve to unblock, just found a couple typos
@@ -1385,6 +1415,21 @@ export interface BasicCreateActionOperation { | |||
* concurrency)? | |||
*/ | |||
shouldLock?: boolean; | |||
|
|||
/** | |||
* Currently an **internaly-only** feature. Zapier uses this |
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.
Found a typo here for internal
|
||
BasicCreateActionOperationSchema.properties.buffer = { | ||
description: | ||
'Currently an **internaly-only** feature. Zapier uses this configuration for creating objects in bulk with `performBuffer`.', |
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.
internal typo
Introducing "Buffered Create Actions"...
A Buffered Create allows you to create objects in bulk with a single or fewer API request(s). This is useful when you want to reduce the number of requests made to your server. When enabled, Zapier holds the data until the buffer reaches a size limit or a certain time has passed, then sends the buffered data using the
performBuffer
function you define.To implement a Buffered Create, you define a
buffer
configuration object and aperformBuffer
function in theoperation
object. In thebuffer
config object, you specify how you want to group the buffered data using thegroupedBy
setting and the maximum number of items to buffer using thelimit
setting.Here's an example: