Skip to content

Replace fixed bootstrap sleep with CountDownLatch#60

Open
EmilioBejasa wants to merge 4 commits intomainfrom
fix/bootstrap-polling
Open

Replace fixed bootstrap sleep with CountDownLatch#60
EmilioBejasa wants to merge 4 commits intomainfrom
fix/bootstrap-polling

Conversation

@EmilioBejasa
Copy link
Copy Markdown
Collaborator

Summary

  • bootstrapManifest() was doing Thread.sleep(10000) — always waiting the full 10s regardless of when RN actually finished registering stories
  • In CI, cold emulators need more than 10s, causing the bootstrap to fail with "Stories manifest not found"

Fix

Set a CountDownLatch on StorybookRegistry before launching StoryRendererActivity. registerStories() counts it down the moment JS calls in. The test awaits the latch instead of sleeping, so bootstrap returns as soon as stories are ready — instantly on fast machines, and up to the 30s safety ceiling on slow CI emulators.

Changes

  • StorybookRegistry: add storiesRegisteredSignal: CountDownLatch?; call countDown() in registerStories()
  • BaseStoryScreenshotTest: replace Thread.sleep with latch.await; raise default bootstrap timeout from 10s → 30s

Test plan

  • CI passes (bootstrap no longer times out on cold emulator)

🤖 Generated with Claude Code

EmilioBejasa and others added 4 commits February 25, 2026 12:43
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Instead of sleeping a fixed 10s waiting for RN to register stories,
set a CountDownLatch before launching StoryRendererActivity and await
it. StorybookRegistry.registerStories() counts it down the moment JS
calls in, so bootstrap returns immediately when stories are ready
rather than always waiting the full timeout.

Also raises the safety ceiling from 10s to 30s to give slow CI
emulators enough headroom.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant