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: don't proceed with ConfigureShorebird if init fails #87

Merged
merged 3 commits into from
Sep 4, 2024

Conversation

bryanoltman
Copy link

If shorebird_init fails, don't proceed to report a launch start or start an update thread.

Fixes shorebirdtech/updater#211

@@ -125,8 +125,11 @@ void ConfigureShorebird(std::string code_cache_path,
app_parameters.original_libapp_paths_size = c_paths.size();

// shorebird_init copies from app_parameters and shorebirdYaml.
shorebird_init(&app_parameters, ShorebirdFileCallbacks(),
shorebird_yaml.c_str());
auto init_result = shorebird_init(&app_parameters, ShorebirdFileCallbacks(),
Copy link

Choose a reason for hiding this comment

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

Is there any way to unit test this to ensure we don't have a regression?

Copy link

@eseidel eseidel left a comment

Choose a reason for hiding this comment

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

Won't this mean that only the first thread to call shorebird will have its snapshot replaced and all others will use the release snapshot?

@eseidel
Copy link

eseidel commented Sep 3, 2024

I believe Firebase Cloud Messaging is an example of where a FlutterEngine is created (and executed) before the main thread is. I think this change as written would cause FCM to use the patch, but then the main app to use the release version?

@bryanoltman
Copy link
Author

Ah, I had been testing with workmanager, which will be started by the app, but you're absolutely right (just confirmed in my FCM app test). I've updated to move the return further down, which will ensure the snapshot is properly set for the app in the FCM case.

Copy link

@eseidel eseidel 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 the most surgical fix, and will probably work, but I think is probably not the right fix for this code long term. I left a long TODO to try and cover that.

Co-authored-by: Eric Seidel <eric@shorebird.dev>
@bryanoltman bryanoltman merged commit 4911402 into shorebird/dev Sep 4, 2024
1 check passed
@bryanoltman bryanoltman deleted the bo/shorebird-init-result branch September 4, 2024 01:46
felangel pushed a commit that referenced this pull request Sep 4, 2024
* fix: don't proceed with ConfigureShorebird if init fails

* move return further down

* Update shell/common/shorebird/shorebird.cc

Co-authored-by: Eric Seidel <eric@shorebird.dev>

---------

Co-authored-by: Eric Seidel <eric@shorebird.dev>
felangel pushed a commit that referenced this pull request Sep 12, 2024
* fix: don't proceed with ConfigureShorebird if init fails

* move return further down

* Update shell/common/shorebird/shorebird.cc

Co-authored-by: Eric Seidel <eric@shorebird.dev>

---------

Co-authored-by: Eric Seidel <eric@shorebird.dev>
felangel pushed a commit that referenced this pull request Oct 28, 2024
* fix: don't proceed with ConfigureShorebird if init fails

* move return further down

* Update shell/common/shorebird/shorebird.cc

Co-authored-by: Eric Seidel <eric@shorebird.dev>

---------

Co-authored-by: Eric Seidel <eric@shorebird.dev>
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.

fix: patches sometimes uninstall right after install (package:flutter_foreground_task)
3 participants