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

Make update check faster #249

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jxstxn1
Copy link

@jxstxn1 jxstxn1 commented Oct 10, 2023

This PR is addressing this issue #174

Starting the update check at the beginning of a command in an isolate and execute the returned function, which contains the _checkCliVersionIntegrity and may contain the print that an update is available

Comment on lines 334 to 336
void Function()? updateCheck;
try {
final updateFuture = VersionChecker.isDependencyUpToDate(
Copy link
Contributor

@passsy passsy Oct 16, 2023

Choose a reason for hiding this comment

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

The try catch is now useless, because the updateFuture is not awaited.
The error of VersionChecker.isDependencyUpToDate() is never caught and would crash the CLI

Copy link
Author

Choose a reason for hiding this comment

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

The Future itself is awaited in Line 345 in combination with the timeout
Errors are caught and result in returning null

@@ -284,8 +284,20 @@ class SidekickCommandRunner<T> extends CompletionCommandRunner<T> {
final unmount = mount(debugName: args.join(' '));

ArgResults? parsedArgs;
Future<void Function()?>? updateCheck;
Copy link
Contributor

Choose a reason for hiding this comment

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

A Future<void> should be sufficient. The void Function() seems redundant

Copy link
Author

Choose a reason for hiding this comment

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

I updated it to a String? :)

Justin Baumann added 2 commits November 4, 2023 15:15
@jxstxn1 jxstxn1 requested a review from passsy January 6, 2024 11:20
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