sentry-demos / ios

iOS Empower Plant
1 stars 4 forks source link

feat: generate "DB on main thread" issues #39

Closed armcknight closed 1 year ago

armcknight commented 1 year ago

Provide a way to generate large amounts of DB entities, so that subsequent fetches take long enough to cause "DB on main thread" issues.

I was able to see DB on Main Thread issues now after generating large amounts of db records and relaunching the app to load them all at once: https://demo.sentry.io/issues/4542023700/?project=6249899&query=is%3Aunresolved+se%3Aandrewmcknight&referrer=issue-stream&statsPeriod=14d&stream_index=0

Here's a quick demo of how to generate the items:

https://github.com/sentry-demos/ios/assets/3241469/5b3f4ee8-f54a-44ea-867d-29e164f0282a

There's also a launch argument you can use to immediately wipe the database if you find it's taking too long to launch the app and you want to start over (make sure not to commit the xcscheme file in git with this enabled): image

closes #25

armcknight commented 1 year ago

I'm not seeing issues yet, even though it generates db spans that take multiple seconds, while the docs state 16 ms is enough. image

See https://andrewsorg.sentry.io/performance/ios:9ce38952e35f46a8aa26bfc1b6c59a2e/?project=4505840007184384&query=&referrer=performance-transaction-summary&statsPeriod=14d&transaction=EmpowerPlantViewController&unselectedSeries=p100%28%29&unselectedSeries=avg%28%29

kpujjigit commented 1 year ago

Verified Working

image