Skip to content

Commit a474b10

Browse files
committed
Fix MockSession race condition
1 parent 48e71f9 commit a474b10

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Tests/Helpers/Mocks.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,8 @@ class MockSession: URLSession {
327327
}
328328

329329
override func resume() {
330-
DispatchQueue.global(qos: .default).async {
331-
self.completionHandler!(self.mockResponse.data, self.mockResponse.urlResponse, self.mockResponse.error)
332-
}
330+
// Call synchronously to avoid race conditions with Swift 6.0+ stricter memory management
331+
self.completionHandler!(self.mockResponse.data, self.mockResponse.urlResponse, self.mockResponse.error)
333332
}
334333
}
335334
}

0 commit comments

Comments
 (0)