{"action":"created","issue":{"url":"https://api.github.com/repos/danthorpe/Operations/issues/175","repository_url":"https://api.github.com/repos/danthorpe/Operations","labels_url":"https://api.github.com/repos/danthorpe/Operations/issues/175/labels{/name}","comments_url":"https://api.github.com/repos/danthorpe/Operations/issues/175/comments","events_url":"https://api.github.com/repos/danthorpe/Operations/issues/175/events","html_url":"https://github.com/danthorpe/Operations/issues/175","id":131133711,"number":175,"title":"Completion Callback isn't called in 100% of all cases","user":{"login":"bastianschilbe","id":1087050,"avatar_url":"https://avatars.githubusercontent.com/u/1087050?v=3","gravatar_id":"","url":"https://api.github.com/users/bastianschilbe","html_url":"https://github.com/bastianschilbe","followers_url":"https://api.github.com/users/bastianschilbe/followers","following_url":"https://api.github.com/users/bastianschilbe/following{/other_user}","gists_url":"https://api.github.com/users/bastianschilbe/gists{/gist_id}","starred_url":"https://api.github.com/users/bastianschilbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bastianschilbe/subscriptions","organizations_url":"https://api.github.com/users/bastianschilbe/orgs","repos_url":"https://api.github.com/users/bastianschilbe/repos","events_url":"https://api.github.com/users/bastianschilbe/events{/privacy}","received_events_url":"https://api.github.com/users/bastianschilbe/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/danthorpe/Operations/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-03T19:50:39Z","updated_at":"2016-02-03T20:54:47Z","closed_at":null,"body":"If you have a operation and prevent it from running by a failed condition, the completion callback isn't always called. Try the following with an iOS test target:\r\n```\r\n    func test__multiple_operations_completion_blocks() {\r\n        \r\n        let q = OperationQueue()\r\n        (0...5000).forEach { i in\r\n            let e = expectationWithDescription(\"wait\\(i)\")\r\n            let operation = BlockOperation(block: { _ in XCTFail() })\r\n            operation.addCompletionBlock({ e.fulfill() })\r\n            let condition = BlockCondition(block: { false })\r\n            operation.addCondition(condition)\r\n            q.addOperation(operation)\r\n        }\r\n        waitForExpectationsWithTimeout(8, handler: nil)\r\n    \r\n    }\r\n```\r\nI see about 1-10 expections unfulfilled.\r\nDo I use conditions the wrong way?"},"comment":{"url":"https://api.github.com/repos/danthorpe/Operations/issues/comments/179460650","html_url":"https://github.com/danthorpe/Operations/issues/175#issuecomment-179460650","issue_url":"https://api.github.com/repos/danthorpe/Operations/issues/175","id":179460650,"user":{"login":"danthorpe","id":309420,"avatar_url":"https://avatars.githubusercontent.com/u/309420?v=3","gravatar_id":"","url":"https://api.github.com/users/danthorpe","html_url":"https://github.com/danthorpe","followers_url":"https://api.github.com/users/danthorpe/followers","following_url":"https://api.github.com/users/danthorpe/following{/other_user}","gists_url":"https://api.github.com/users/danthorpe/gists{/gist_id}","starred_url":"https://api.github.com/users/danthorpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danthorpe/subscriptions","organizations_url":"https://api.github.com/users/danthorpe/orgs","repos_url":"https://api.github.com/users/danthorpe/repos","events_url":"https://api.github.com/users/danthorpe/events{/privacy}","received_events_url":"https://api.github.com/users/danthorpe/received_events","type":"User","site_admin":false},"created_at":"2016-02-03T20:54:46Z","updated_at":"2016-02-03T20:54:46Z","body":"Okay, could well be a lock issue inside the state. Hopefully, the verbose state changes can reveal if a dependency has not finished.\r\n\r\nI'm working on another issue right now, but I'll come back to this and use your loop test case as a starting point."}}