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

Promise.zip execution changes #654

Merged

Conversation

davishmcclurg
Copy link
Contributor

@davishmcclurg davishmcclurg commented May 25, 2017

I added details for each change in the commit messages.
Let me know if you'd like these in separate PRs.

@pitr-ch pitr-ch added the enhancement Adding features, adding tests, improving documentation. label Jul 23, 2017
@pitr-ch pitr-ch added this to the 1.1.1 milestone Jul 23, 2017
@pitr-ch
Copy link
Member

pitr-ch commented Jul 23, 2017

Thanks. The change makes sense but as you said it's a breaking change. Could you introduce the non-executing behavior with an option passed to zip?

@davishmcclurg
Copy link
Contributor Author

@pitr-ch I added an execute option and switched the default back to returning a fulfilled promise.

@pitr-ch
Copy link
Member

pitr-ch commented Nov 18, 2017

@davishmcclurg Thanks for the update, looks good. One last think though, could you update the documentation to mention the new option?

@davishmcclurg
Copy link
Contributor Author

@pitr-ch I finally got around to updating the docs. I believe @overload was necessary here, but let me know if there's something cleaner.

@pitr-ch pitr-ch modified the milestones: 1.1.1, 1.1.0 Feb 21, 2018
davishmcclurg and others added 4 commits February 24, 2018 21:24
It's unnecessary to immediately execute promises that are chained
together with `zip`. This feels like a bug to me, but I'm sure people
are relying on the old behavior, so this is definitely a breaking
change.
The use case for this is a little strange, since you can set the
executors for the zipped promises when they're created instead. In my
case, it would make it easier to run a number of immediately executed
promises on a pool:

```
p1 = Concurrent::Promise.new(executor: :immediate) { ... }
p2 = Concurrent::Promise.new(executor: :immediate) { ... }

...

Concurrent::Promise.zip(p1, p2, executor: SOME_THREAD_POOL).then { ... }
```
This restores the default behavior for zipped promises and adds an
option (`execute`) to leave them unscheduled.
@ghost ghost assigned pitr-ch Feb 24, 2018
@ghost ghost added the in progress label Feb 24, 2018
@pitr-ch
Copy link
Member

pitr-ch commented Feb 24, 2018

Thanks looks great! I've rebased the PR to pass the CI. When green I'll merge it.

@pitr-ch pitr-ch merged commit 705325e into ruby-concurrency:master Feb 24, 2018
@ghost ghost removed the in progress label Feb 24, 2018
@davishmcclurg davishmcclurg deleted the davishmcclurg/promise-zip branch February 24, 2018 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding features, adding tests, improving documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants