Skip to content

Commit 70761d2

Browse files
committed
Update ProductsInfoController.swift
Reverted addition of OSSpinLock, which is both deprecated and causes hangs when used incorrectly (which is easy and happens frequently).
1 parent e9815a1 commit 70761d2

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

Sources/SwiftyStoreKit/ProductsInfoController.swift

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,19 @@ class ProductsInfoController: NSObject {
4444
}
4545

4646
let inAppProductRequestBuilder: InAppProductRequestBuilder
47-
48-
private var spinLock: OSSpinLock
49-
5047
init(inAppProductRequestBuilder: InAppProductRequestBuilder = InAppProductQueryRequestBuilder()) {
5148
self.inAppProductRequestBuilder = inAppProductRequestBuilder
52-
self.spinLock = OSSpinLock()
5349
}
5450

5551
// As we can have multiple inflight requests, we store them in a dictionary by product ids
5652
private var inflightRequests: [Set<String>: InAppProductQuery] = [:]
5753

5854
@discardableResult
5955
func retrieveProductsInfo(_ productIds: Set<String>, completion: @escaping (RetrieveResults) -> Void) -> InAppProductRequest {
60-
OSSpinLockLock(&self.spinLock)
61-
defer {
62-
OSSpinLockUnlock(&self.spinLock)
63-
}
6456

6557
if inflightRequests[productIds] == nil {
6658
let request = inAppProductRequestBuilder.request(productIds: productIds) { results in
67-
OSSpinLockLock(&self.spinLock)
68-
defer {
69-
OSSpinLockUnlock(&self.spinLock)
70-
}
71-
59+
7260
if let query = self.inflightRequests[productIds] {
7361
for completion in query.completionHandlers {
7462
completion(results)

0 commit comments

Comments
 (0)