Skip to content

Commit

Permalink
Merge aa9fe51 into 3a1d58d
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrenskers authored Nov 16, 2022
2 parents 3a1d58d + aa9fe51 commit 92b8904
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/Sentry/SentryOutOfMemoryTracker.m
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "NSDate+SentryExtras.h"
#import "SentryEvent+Private.h"
#import "SentryFileManager.h"
#import <Foundation/Foundation.h>
Expand Down Expand Up @@ -68,6 +69,12 @@ - (void)start
self.options.maxBreadcrumbs)];
}

NSDictionary *lastBreadcrumb = event.serializedBreadcrumbs.lastObject;
if (lastBreadcrumb && [lastBreadcrumb objectForKey:@"timestamp"]) {
NSString *timestampIso8601String = [lastBreadcrumb objectForKey:@"timestamp"];
event.timestamp = [NSDate sentry_fromIso8601String:timestampIso8601String];
}

SentryException *exception =
[[SentryException alloc] initWithValue:SentryOutOfMemoryExceptionValue
type:SentryOutOfMemoryExceptionType];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ class SentryOutOfMemoryTrackerTests: NotificationCenterTestCase {
fixture.fileManager.moveBreadcrumbsToPreviousBreadcrumbs()
sut.start()
assertOOMEventSent(expectedBreadcrumbs: 2)

let crashEvent = fixture.client.captureCrashEventInvocations.first?.event
XCTAssertEqual(crashEvent?.timestamp, breadcrumb.timestamp)
}

func testAppOOM_WithOnlyHybridSdkDidBecomeActive() {
Expand Down

0 comments on commit 92b8904

Please sign in to comment.