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

Fix batching for nested flatmaps at different levels of composition #108

Merged
merged 2 commits into from
Sep 15, 2015

Conversation

stevenheidel
Copy link
Contributor

A coworker found an edge case that meant we weren't optimally batching in the flushDownstream method. I had to make the getClumpsByLevel a bit more sophisticated to handle this.

// Implementation note: this test will fail if ClumpContext::getClumpsByLevel does not satisfy the requirement that
// "Clumps appear as early in the list as possible"
"for clumps created inside nested flatmaps at different levels of composition" in new Context {
val clump1 = Clump.value(1).flatMap(source1.get).flatMap(source2.get).map(identity)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the .map(identity) here used to make it quit correctly batching requests after the first one. It would still get the right answer but it was doing too many calls to the source.

@stevenheidel
Copy link
Contributor Author

@fwbrasil @williamboxhall - look good to you?

@fwbrasil
Copy link
Contributor

👍

stevenheidel added a commit that referenced this pull request Sep 15, 2015
Fix batching for nested flatmaps at different levels of composition
@stevenheidel stevenheidel merged commit b6f5613 into getclump:master Sep 15, 2015
@stevenheidel stevenheidel deleted the edgecase branch September 15, 2015 16:46
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