-
Notifications
You must be signed in to change notification settings - Fork 21
Add coalesce example #281
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
base: main
Are you sure you want to change the base?
Add coalesce example #281
Conversation
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 think it's a good example but I think it needs a bit more context/explanation/comments. It takes a while to understand the purpose, how things fit together, and why just an idempotency key/attach was unsufficient.
## Coalesce Workflows | ||
[<img src="https://raw.githubusercontent.com/restatedev/img/refs/heads/main/show-code.svg">](src/coalesce/coalesce.ts) | ||
|
||
This example shows how incoming requests can be deduplicated such that all concurrent clients see the same result. |
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.
Can this be improved to explain how the behavior here is different from just using an idempotency key?
const workflowID = `${ctx.key}-${count}`; | ||
const handle = ctx | ||
.workflowSendClient(TargetWorkflow, workflowID) | ||
.run(input); |
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.
Thank you for putting together this example. I guess here we could also do genericSend
and pass the target workflow in as a parameter?
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.
certainly yes!
No description provided.