Skip to content

ref(replay): Use main thread to schedule capture #4542

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

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

Conversation

romtsn
Copy link
Member

@romtsn romtsn commented Jul 7, 2025

📜 Description

  • This reworks the logic to schedule screenshot + VH capture on the main thread using Handler.postDelayed
    • We were anyway posting a message from the capturer thread to the main thread before, so this gets rid of thread context switch all the time, plus ensures we run view checks (like root.width/height) on the main thread right before we capture

A couple of replay examples with the new capture logic:

https://sentry-sdks.sentry.io/explore/replays/699aa0aff2e2496db716274d637f6a33
https://sentry-sdks.sentry.io/explore/replays/d043fb059023427b97fe54f4abf39832

💡 Motivation and Context

💚 How did you test it?

Manually

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Contributor

github-actions bot commented Jul 7, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 376.06 ms 415.75 ms 39.69 ms
Size 1.58 MiB 2.09 MiB 519.30 KiB

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