Skip to content
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

add new all-settled promise handler #57

Merged
merged 5 commits into from
May 16, 2024

Conversation

mintybayleaf
Copy link
Contributor

@mintybayleaf mintybayleaf commented May 13, 2024

I added a new promise handling function called allSettled historically in most programming languages this function name waits for every promise to finish running (or failing) before performing operations on them.

This is really good for batching activities in a workflow or maybe one child workflows in a workflow

I used this to wait for a batch of activities to run then handle the errors at the end if any exist.

I would like it if I could implement the function in the repository because leveraging the internals of the temporal.promise in the SDK here is a bit nasty to do in our repository.

This is a lot cleaner and could be useful to others (at least I think so)

I implemented the feature like this because of these two examples from the Temporal core team (as maxim suggested)

  1. https://github.com/temporalio/samples-java/tree/main/core/src/main/java/io/temporal/samples/batch

  2. https://community.temporal.io/t/async-activities-in-workflow/896

SIDE NOTE:

Also fixes a bug in the scheduling code that was not pulling the :schedule key out of the options passed into the schedule like one would assume.

Bailey Kocin added 2 commits May 13, 2024 16:49
Signed-off-by: Bailey Kocin <bkocin@crossbeam.com>
Signed-off-by: Bailey Kocin <bkocin@crossbeam.com>
Bailey Kocin added 2 commits May 13, 2024 18:38
Signed-off-by: Bailey Kocin <bkocin@crossbeam.com>
Signed-off-by: Bailey Kocin <bkocin@crossbeam.com>
Signed-off-by: Bailey Kocin <bkocin@crossbeam.com>
@mintybayleaf mintybayleaf changed the title add new allSettled handler add new all-settled promise handler May 13, 2024
@ghaskins ghaskins merged commit 9b75d8b into manetu:master May 16, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants