Browse Source

Update ProductsInfoController.swift

Reverted addition of OSSpinLock, which is both deprecated and causes hangs when used incorrectly (which is easy and happens frequently).
Sam Spencer 4 years ago
parent
commit
70761d29fc
1 changed files with 1 additions and 13 deletions
  1. 1 13
      Sources/SwiftyStoreKit/ProductsInfoController.swift

+ 1 - 13
Sources/SwiftyStoreKit/ProductsInfoController.swift

@@ -44,12 +44,8 @@ class ProductsInfoController: NSObject {
     }
     
     let inAppProductRequestBuilder: InAppProductRequestBuilder
-
-    private var spinLock: OSSpinLock
-  
     init(inAppProductRequestBuilder: InAppProductRequestBuilder = InAppProductQueryRequestBuilder()) {
         self.inAppProductRequestBuilder = inAppProductRequestBuilder
-        self.spinLock = OSSpinLock()
     }
     
     // As we can have multiple inflight requests, we store them in a dictionary by product ids
@@ -57,18 +53,10 @@ class ProductsInfoController: NSObject {
 
     @discardableResult
     func retrieveProductsInfo(_ productIds: Set<String>, completion: @escaping (RetrieveResults) -> Void) -> InAppProductRequest {
-        OSSpinLockLock(&self.spinLock)
-        defer {
-          OSSpinLockUnlock(&self.spinLock)
-        }
 
         if inflightRequests[productIds] == nil {
             let request = inAppProductRequestBuilder.request(productIds: productIds) { results in
-                OSSpinLockLock(&self.spinLock)
-                defer {
-                  OSSpinLockUnlock(&self.spinLock)
-                }
-              
+                
                 if let query = self.inflightRequests[productIds] {
                     for completion in query.completionHandlers {
                         completion(results)