     private let onResponse: ([JSON]?) -> ()
     private let onKeyExpired: () -> ()
     private var currentRequest: RequestExecution?
-    
-    override var isFinished: Bool {
-        return canFinish
-    }
-    
-    private var canFinish = false {
-        willSet {
-            willChangeValue(forKey: "isFinished")
-        }
-        didSet {
-            didChangeValue(forKey: "isFinished")
-        }
-    }
+    private let semaphore = DispatchSemaphore(value: 0)
     
     private override init() {
         fatalError()

    override func cancel() {
        super.cancel()
        currentRequest?.cancel()
        canFinish = true
    }
}

                
                if response["failed"].intValue > 0 {
                    self.onKeyExpired()
                    self.semaphore.signal()
                }
                else {
                    let newTs = response["ts"].stringValue
