Add timeout flag to devices command, pipe through discovery#51678
Add timeout flag to devices command, pipe through discovery#51678jmagman merged 1 commit intoflutter:masterfrom
Conversation
52d667f to
5ade80d
Compare
There was a problem hiding this comment.
$ flutter devices -t 20 -v
[ +3 ms] executing: /Users/m/Projects/flutter/bin/cache/artifacts/fuchsia/tools/device-finder list -full -timeout 20000ms
[+20357 ms] 2020/03/02 12:48:39 no devices found
zanderso
left a comment
There was a problem hiding this comment.
See emailed comment. Also watch out for long lines. Lines can be longer that 80 iff they improve readability.
|
Change seems reasonable, but please verify if this requires updates for the google3 tool implementations. Adding a new named parameter to a subclass is not breaking, but adding it to a superclass isn't |
There was a problem hiding this comment.
I needed to add a mechanism to not used the _items cache because in my next commit I'm going to be doing a quick default timeout, then longer when a particular ID is specified but not found. But since you guys pointed out how annoying adding default params is in g3 I'm going to do both in the same PR in case they get split over rolls.
There was a problem hiding this comment.
Instead of adding a parameter for whether to use caching, you could also add a new method, like refreshDevices({Duration timeout}). If g3 is doing extends and not implement, adding a method won't be a breaking change.
zanderso
left a comment
There was a problem hiding this comment.
Can you test the behavior of the timeout parameter at some level using FakeAsync?
There was a problem hiding this comment.
Instead of adding a parameter for whether to use caching, you could also add a new method, like refreshDevices({Duration timeout}). If g3 is doing extends and not implement, adding a method won't be a breaking change.
There's actually no dart code using this timeout (there was before in |
d8954aa to
e54a57f
Compare
I added this method, though this is already requires an update to the PollingDeviceDiscovery g3 subclasses due to |
zanderso
left a comment
There was a problem hiding this comment.
lgtm w/ nits assuming pollingGetDevices was the only breaking change.
There was a problem hiding this comment.
How about:
globals.printStatus('If a connected device was not detected, please run "flutter doctor" to diagnose potential issues.');
if (timeout == null) {
globals.printStatus('You may also try increasing the time to wait for connected devices with the --timeout flag.');
}
globals.printStatus('visit https://flutter.dev/setup/ for troubleshooting tips.');or make a StringBuffer to avoid multiple globals.printStatus() calls.
There was a problem hiding this comment.
Before:
$ flutter devices
No devices detected.
Run 'flutter emulators' to list and start any available device emulators.
Or, if you expected your device to be detected, please run "flutter doctor" to
diagnose potential issues, or visit https://flutter.dev/setup/ for
troubleshooting tips.
After:
flutter$ flutter devices
No devices detected.
Run "flutter emulators" to list and start any available device emulators.
If you expected your device to be detected, please run "flutter doctor" to
diagnose potential issues. You may also try increasing the time to wait for
connected devices with the --timeout flag. Visit https://flutter.dev/setup/ for
troubleshooting tips.
|
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Description
Add a
--timeoutflag toflutter devicesso device discovery can use a potentially longer timeout. Use the timeout for finding iOS and Fuchsia devices. This will be needed so users can discover networked iOS devices that require a longer timeout than the default.Also improves daemon polling behavior so the polling timeout can be piped down into the tools to override their default timeouts (like
device-finderandxcdevice) instead of just killing the process.Related Issues
Next part of #15072.
Tests
Added xcode_test, daemon_test, device_test, other device subclass tests.
There weren't any
device-findertests I could find. Will test this manually.Checklist
///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change