Skip to content
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

Checking if a block has been cancelled immediately before it runs #35

Merged
merged 2 commits into from
Sep 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ConsistencyManager/ConsistencyManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,10 @@ public class ConsistencyManager {
// Default to true if weakOperation is nil
return weakOperation?.cancelled ?? true
}
// Let's check here to see if it's cancelled before we start
if cancelled() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super-minor: instead of cancelled() here, I'd put () at the end of the { } block above, so you can just say if cancelled

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't do that because I pass the cancelled block into the next function.
I actually need that closure.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah my bad 👍

return
}
task(cancelled)
}
weakOperation = operation
Expand Down