Skip to content
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

impr: Stop canceling timer for manual transactions #4380

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

- Speed up HTTP tracking for multiple requests in parallel (#4366)
- Slightly speed up SentryInAppLogic (#4370)
- Stop canceling timer for manual transactions (#4380)

## 8.37.0-beta.1

Expand Down
4 changes: 4 additions & 0 deletions Sources/Sentry/SentryTracer.m
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ - (void)deadlineTimerFired

- (void)cancelDeadlineTimer
{
if (self.deadlineTimer == nil) {
return;
}

// If the main thread is busy the tracer could be deallocated in between.
__weak SentryTracer *weakSelf = self;

Expand Down
12 changes: 12 additions & 0 deletions Tests/SentryTests/Transaction/SentryTracerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,18 @@ class SentryTracerTests: XCTestCase {

fixture.timerFactory.fire()
}

func testDeadlineTimerForManualTransaction_NoWorkQueuedOnMainQueue() {
let sut = fixture.getSut(waitForChildren: false, idleTimeout: 0.0)

let invocationsBeforeFinish = fixture.dispatchQueue.blockOnMainInvocations.count

sut.finish()

let invocationsAfterFinish = fixture.dispatchQueue.blockOnMainInvocations.count

XCTAssertEqual(invocationsBeforeFinish, invocationsAfterFinish)
}

func testFramesofSpans_SetsDebugMeta() {
let sut = fixture.getSut()
Expand Down
Loading