-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/add extension to support tests #96
Open
LisaKonysheva
wants to merge
5
commits into
pluralsight:master
Choose a base branch
from
auto1-oss:feature/add-extension-to-support-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature/add extension to support tests #96
LisaKonysheva
wants to merge
5
commits into
pluralsight:master
from
auto1-oss:feature/add-extension-to-support-tests
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…pletion block execution
Problem was that “isReady” property change KVO event was generated on every “state” property change, but in most of cases state-change doesn’t mean isReady-change. After every isReady KVO event, isReady property is read by NSOperations runtime. Since state-change (and as a result isReady KVO event) may happen and happens in multiple threads, isReady-getter is called from multiple threads too. The problem happens when isReady is called from multiple threads around the same time: the first call return False, but the second one returns True. Since there are two threads, first call can be actually finished after second one. In this case NSOperations runtime receivce isReady state value in the order like [false, false… false, true, false]. In this situation operations is actually ready, but it is not executed by queue (looks like because last isReady state was False). To fix the described problem idea is to stop bombing with KVO events. Actually during NSOperation life isReady is changed only once from false -> true. So ideally is to have only one KVO event when operations is really ready.
jjatie
reviewed
Nov 14, 2018
@@ -96,7 +98,9 @@ open class OperationQueue: Foundation.OperationQueue { | |||
*/ | |||
operation.addCompletionBlock { [weak self, weak operation] in | |||
guard let queue = self, let operation = operation else { return } | |||
queue.delegate?.operationQueue?(queue, operationDidFinish: operation, withErrors: []) | |||
if let delegate = queue.delegate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why write something more verbose? Optional chaining already indicated that we are only performing the delegate if the delegate exists.
No description? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.