This repository has been archived by the owner on Oct 6, 2021. It is now read-only.
forked from foursquare/FSNetworking
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
proposed fix for github issue foursquare#8: error property now set on…
… main thread; complete is idempotent by ignoring subsequent calls.
- Loading branch information
Showing
1 changed file
with
18 additions
and
28 deletions.
There are no files selected for viewing
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
9cbe3d4
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.
this gets rid of failWithError, which was an intermediate step that occurs in the background. it also moves the connection nullification from performCompleteWithError to completeWithError; callers from the main thread can just call the latter directly. As I recall, the old idea was that we want to release things as soon as possible, but in hindsight it seems safer and clearer to just do it on the main thread a tiny bit later.
all of these state updates now happen in completeWithError, which is made idempotent by a check to self.didComplete.
i have not tested this beyond running the demo app and i understand that this might be a higher risk patch than you are willing to deal with at the moment, but i do think it's a step in the right direction for the library. it would be great if someone could put this into a beta build and qualify it.
9cbe3d4
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.
Without a huge amount of empirical evidence to back it, this looks like a reasonable change that would help with race conditions around
failWithError:
andsetError:
.Thanks @gwk for the quick maintenance work. Do you maintain this fork? We'd consider using your code if it tackles a few bugs foursquare isn't ready to deal with at the moment.
9cbe3d4
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.