Skip to content

fix(android): allow initialize to be retried after it throws - #516

Open
malopezr7 wants to merge 1 commit into
callstack:mainfrom
malopezr7:fix/android-initialize-retry-after-failure
Open

malopezr7 wants to merge 1 commit into
callstack:mainfrom
malopezr7:fix/android-initialize-retry-after-failure

Conversation

@malopezr7

Copy link
Copy Markdown
Contributor

Fixes #515

initialize and loadNativeLibs set their AtomicBoolean before doing the work, so a throw left them marked as done. A retry then returned without error and ReactNativeBrownfield.shared was never set.

This PR moves both guards into a small RetryableOnce helper. It still runs the block at most once and still skips concurrent calls, but a block that throws no longer counts, so the next call runs it again. The error itself still propagates. Successful starts behave as before.

Testing

  • RetryableOnceTest: a completed block does not run again; a block that throws runs again on the next call.
  • ./gradlew :callstack_react-native-brownfield:testDebugUnitTest (in apps/RNApp/android) and yarn lint pass.

This branch has not been deployed

No deployments
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.

Android: initialize cannot be retried after it throws

1 participant