Skip to content

Commit d5189c9

Browse files
robert-smartbearRobert Bartoszewski
andauthored
Fix reporting long background app startup spans (#524)
Co-authored-by: Robert Bartoszewski <robert.smartbear@gmail.com>
1 parent 3b478e9 commit d5189c9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/BugsnagPerformance/Private/Instrumentation/AppStartupInstrumentation.mm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
using namespace bugsnag;
2222

23+
static constexpr CFTimeInterval kMaxDurationFromLaunchToActive = 5;
2324
static constexpr CFTimeInterval kMaxDuration = 120;
2425

2526
static CFAbsoluteTime getProcessStartTime() noexcept;
@@ -181,6 +182,12 @@ static inline bool isActivePrewarm(void) {
181182
return;
182183
}
183184
shouldRespondToAppDidBecomeActive_ = false;
185+
186+
if (CFAbsoluteTimeGetCurrent() > didFinishLaunchingAtTime_ + kMaxDurationFromLaunchToActive) {
187+
abortAllSpans();
188+
isEnabled_ = false;
189+
return;
190+
}
184191

185192
didBecomeActiveAtTime_ = CFAbsoluteTimeGetCurrent();
186193
[[BugsnagPerformanceCrossTalkAPI sharedInstance] willEndUIInitSpan:uiInitSpan_];

0 commit comments

Comments
 (0)