Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Possible bug in Async.flatten #136

Closed
MrMage opened this issue Apr 25, 2018 · 1 comment · Fixed by #138
Closed

Possible bug in Async.flatten #136

MrMage opened this issue Apr 25, 2018 · 1 comment · Fixed by #138
Assignees
Labels
Milestone

Comments

@MrMage
Copy link
Contributor

MrMage commented Apr 25, 2018

According to https://github.com/vapor/core/blob/master/Sources/Async/Future%2BFlatten.swift, "the order of the results will match the order of the futures in the input array.". But the current implementation simply adds an awaiter to each future, which appends its result to the final result array. That means that elements actually get appended in the order in which the futures are fulfilled, not in the order the futures had in the input array.

@tanner0101 tanner0101 added the bug label Apr 30, 2018
@tanner0101 tanner0101 self-assigned this Apr 30, 2018
@tanner0101 tanner0101 added this to the 3.1.4 milestone Apr 30, 2018
@tanner0101
Copy link
Member

That is a bug, thank you for finding that @MrMage. We used to have an orderedFlatten and non ordered flatten. It looks like the docs for orderedFlatten got applied here incorrectly. I think the best solution here is to make this actually do an ordered flatten.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants