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

Discover devices in parallel instead of serially waiting for each device type #51015

Merged
merged 1 commit into from
Feb 20, 2020

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Feb 19, 2020

Description

For the next part of wireless iOS device support, make all the DeviceDiscovery.devices calls run at the same time in a Future.wait<List<Device>>(). This is necessary so the network device timeouts (to be introduced in the next PR) increase the time linearly instead of exponentially.

Breaking out just this change to make the next PR smaller, and changing the Stream=>List return value in the signature created some churn.

Related Issues

Another piece of #15072.

Tests

Updated tests to use lists instead of streams.

Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.

@jmagman jmagman added the tool Affects the "flutter" command-line tool. See also t: labels. label Feb 19, 2020
@jmagman jmagman self-assigned this Feb 19, 2020
yield device;
}
}
Future<List<Device>> getAllConnectedDevices() async {
Copy link
Member Author

Choose a reason for hiding this comment

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

@zanderso in #49854 (comment):

This could return a Stream if we're actually getting results bit-by-bit [...] or if this is implementing an interface that requires it to be a Stream, but otherwise we should probably prefer Future<List>, or Future<Iterable>.

(async* Streams also can have some surprising behavior. IIRC they don't interact well with FakeAsync for tests.)

@jonahwilliams
Copy link
Member

This change looks good to me, but it will likely require a corresponding update in the google3 tool- I can point you at the sources tomorrow.

Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

This is great, LGTM

@jmagman
Copy link
Member Author

jmagman commented Feb 20, 2020

Kicking cocoon, landing on red.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants