{"action":"created","comment":{"url":"https://api.github.com/repos/rs/SDWebImage/pulls/comments/208846835","pull_request_review_id":144739047,"id":208846835,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODg0NjgzNQ==","diff_hunk":"@@ -429,20 +429,20 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didRece\n @implementation SDWebImageDownloadToken\n \n - (void)dealloc {\n-    [[NSNotificationCenter defaultCenter] removeObserver:self name:SDWebImageDownloadReceiveResponseNotification object:nil];\n+    [[NSNotificationCenter defaultCenter] removeObserver:self name:SDWebImageDownloadReceiveResponseNotification object:_downloadOperation];\n }\n \n-- (instancetype)init {\n-    self = [super init];\n-    if (self) {\n-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadReceiveResponse:) name:SDWebImageDownloadReceiveResponseNotification object:nil];\n+- (void)setDownloadOperation:(NSOperation<SDWebImageDownloaderOperation> *)downloadOperation {\n+    if (downloadOperation != _downloadOperation) {\n+        [[NSNotificationCenter defaultCenter] removeObserver:self name:SDWebImageDownloadReceiveResponseNotification object:_downloadOperation];\n+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadReceiveResponse:) name:SDWebImageDownloadReceiveResponseNotification object:downloadOperation];\n+        _downloadOperation = downloadOperation;\n     }","path":"SDWebImage/SDWebImageDownloader.m","position":null,"original_position":17,"commit_id":"ab5b5677b2370ccf4a0317ece18aa5c63b29e979","original_commit_id":"8cfda3dce91416988b028e50f142020b599ac688","user":{"login":"dreampiggy","id":6919743,"node_id":"MDQ6VXNlcjY5MTk3NDM=","avatar_url":"https://avatars2.githubusercontent.com/u/6919743?v=4","gravatar_id":"","url":"https://api.github.com/users/dreampiggy","html_url":"https://github.com/dreampiggy","followers_url":"https://api.github.com/users/dreampiggy/followers","following_url":"https://api.github.com/users/dreampiggy/following{/other_user}","gists_url":"https://api.github.com/users/dreampiggy/gists{/gist_id}","starred_url":"https://api.github.com/users/dreampiggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dreampiggy/subscriptions","organizations_url":"https://api.github.com/users/dreampiggy/orgs","repos_url":"https://api.github.com/users/dreampiggy/repos","events_url":"https://api.github.com/users/dreampiggy/events{/privacy}","received_events_url":"https://api.github.com/users/dreampiggy/received_events","type":"User","site_admin":false},"body":"@zhongwuzw Yeah...If the `object` arg in the `addObserver:selector:name:object:` was not be stored as `unsafe_ unsafe_unretaind` like the behavior of `observer` before iOS 9, so my worry can be disappear.\r\n\r\nI test this code with demo running iOS 8, it seems works without any issue. Maybe this can be adoptable.","created_at":"2018-08-09T08:32:59Z","updated_at":"2018-08-09T08:33:00Z","html_url":"https://github.com/rs/SDWebImage/pull/2426#discussion_r208846835","pull_request_url":"https://api.github.com/repos/rs/SDWebImage/pulls/2426","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/rs/SDWebImage/pulls/comments/208846835"},"html":{"href":"https://github.com/rs/SDWebImage/pull/2426#discussion_r208846835"},"pull_request":{"href":"https://api.github.com/repos/rs/SDWebImage/pulls/2426"}},"in_reply_to_id":208510510},"pull_request":{"url":"https://api.github.com/repos/rs/SDWebImage/pulls/2426","id":206920436,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2OTIwNDM2","html_url":"https://github.com/rs/SDWebImage/pull/2426","diff_url":"https://github.com/rs/SDWebImage/pull/2426.diff","patch_url":"https://github.com/rs/SDWebImage/pull/2426.patch","issue_url":"https://api.github.com/repos/rs/SDWebImage/issues/2426","number":2426,"state":"open","locked":false,"title":"Make download receive response notification only dispatch to specific observer","user":{"login":"zhongwuzw","id":5061845,"node_id":"MDQ6VXNlcjUwNjE4NDU=","avatar_url":"https://avatars0.githubusercontent.com/u/5061845?v=4","gravatar_id":"","url":"https://api.github.com/users/zhongwuzw","html_url":"https://github.com/zhongwuzw","followers_url":"https://api.github.com/users/zhongwuzw/followers","following_url":"https://api.github.com/users/zhongwuzw/following{/other_user}","gists_url":"https://api.github.com/users/zhongwuzw/gists{/gist_id}","starred_url":"https://api.github.com/users/zhongwuzw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhongwuzw/subscriptions","organizations_url":"https://api.github.com/users/zhongwuzw/orgs","repos_url":"https://api.github.com/users/zhongwuzw/repos","events_url":"https://api.github.com/users/zhongwuzw/events{/privacy}","received_events_url":"https://api.github.com/users/zhongwuzw/received_events","type":"User","site_admin":false},"body":"Make download receive response notification only dispatch to specific observer\r\n\r\n### New Pull Request Checklist\r\n\r\n* [x] I have read and understood the [CONTRIBUTING guide](https://github.com/rs/SDWebImage/blob/master/.github/CONTRIBUTING.md)\r\n* [x] I have read the [Documentation](http://cocoadocs.org/docsets/SDWebImage/)\r\n* [x] I have searched for a similar pull request in the [project](https://github.com/rs/SDWebImage/pulls) and found none\r\n\r\n* [ ] I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)\r\n* [ ] I have added the required tests to prove the fix/feature I am adding\r\n* [ ] I have updated the documentation (if necessary)\r\n* [ ] I have run the tests and they pass\r\n* [ ] I have run the lint and it passes (`pod lib lint`)\r\n\r\nThis merge request fixes / reffers to the following issues: ...\r\n\r\n### Pull Request Description\r\n\r\nCurrently, we add observer when create `SDWebImageDownloadToken`, when post `SDWebImageDownloadReceiveResponseNotification`, every observer would receive notification, we use `downloadOperation == self.downloadOperation` to filter its wanted notification. It's not necessary, e.x. Let's assume we have 10 `downloadToken`, each download would be post notification once, so notification center would dispatch selector at most (1 + 2 + 3 + ..... + 10) = 55 times in main thread. After my `PR`, we only dispatch 10 times.\r\n\r\n","created_at":"2018-08-08T07:48:40Z","updated_at":"2018-08-09T08:33:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2619cd5a989e2401a1448deff0f919da8ed9c13f","assignee":null,"assignees":[],"requested_reviewers":[{"login":"mythodeia","id":1748458,"node_id":"MDQ6VXNlcjE3NDg0NTg=","avatar_url":"https://avatars2.githubusercontent.com/u/1748458?v=4","gravatar_id":"","url":"https://api.github.com/users/mythodeia","html_url":"https://github.com/mythodeia","followers_url":"https://api.github.com/users/mythodeia/followers","following_url":"https://api.github.com/users/mythodeia/following{/other_user}","gists_url":"https://api.github.com/users/mythodeia/gists{/gist_id}","starred_url":"https://api.github.com/users/mythodeia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythodeia/subscriptions","organizations_url":"https://api.github.com/users/mythodeia/orgs","repos_url":"https://api.github.com/users/mythodeia/repos","events_url":"https://api.github.com/users/mythodeia/events{/privacy}","received_events_url":"https://api.github.com/users/mythodeia/received_events","type":"User","site_admin":false},{"login":"dreampiggy","id":6919743,"node_id":"MDQ6VXNlcjY5MTk3NDM=","avatar_url":"https://avatars2.githubusercontent.com/u/6919743?v=4","gravatar_id":"","url":"https://api.github.com/users/dreampiggy","html_url":"https://github.com/dreampiggy","followers_url":"https://api.github.com/users/dreampiggy/followers","following_url":"https://api.github.com/users/dreampiggy/following{/other_user}","gists_url":"https://api.github.com/users/dreampiggy/gists{/gist_id}","starred_url":"https://api.github.com/users/dreampiggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dreampiggy/subscriptions","organizations_url":"https://api.github.com/users/dreampiggy/orgs","repos_url":"https://api.github.com/users/dreampiggy/repos","events_url":"https://api.github.com/users/dreampiggy/events{/privacy}","received_events_url":"https://api.github.com/users/dreampiggy/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rs/SDWebImage/pulls/2426/commits","review_comments_url":"https://api.github.com/repos/rs/SDWebImage/pulls/2426/comments","review_comment_url":"https://api.github.com/repos/rs/SDWebImage/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rs/SDWebImage/issues/2426/comments","statuses_url":"https://api.github.com/repos/rs/SDWebImage/statuses/ab5b5677b2370ccf4a0317ece18aa5c63b29e979","head":{"label":"zhongwuzw:remove-notification-dispatch","ref":"remove-notification-dispatch","sha":"ab5b5677b2370ccf4a0317ece18aa5c63b29e979","user":{"login":"zhongwuzw","id":5061845,"node_id":"MDQ6VXNlcjUwNjE4NDU=","avatar_url":"https://avatars0.githubusercontent.com/u/5061845?v=4","gravatar_id":"","url":"https://api.github.com/users/zhongwuzw","html_url":"https://github.com/zhongwuzw","followers_url":"https://api.github.com/users/zhongwuzw/followers","following_url":"https://api.github.com/users/zhongwuzw/following{/other_user}","gists_url":"https://api.github.com/users/zhongwuzw/gists{/gist_id}","starred_url":"https://api.github.com/users/zhongwuzw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhongwuzw/subscriptions","organizations_url":"https://api.github.com/users/zhongwuzw/orgs","repos_url":"https://api.github.com/users/zhongwuzw/repos","events_url":"https://api.github.com/users/zhongwuzw/events{/privacy}","received_events_url":"https://api.github.com/users/zhongwuzw/received_events","type":"User","site_admin":false},"repo":{"id":134236028,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQyMzYwMjg=","name":"SDWebImage","full_name":"zhongwuzw/SDWebImage","owner":{"login":"zhongwuzw","id":5061845,"node_id":"MDQ6VXNlcjUwNjE4NDU=","avatar_url":"https://avatars0.githubusercontent.com/u/5061845?v=4","gravatar_id":"","url":"https://api.github.com/users/zhongwuzw","html_url":"https://github.com/zhongwuzw","followers_url":"https://api.github.com/users/zhongwuzw/followers","following_url":"https://api.github.com/users/zhongwuzw/following{/other_user}","gists_url":"https://api.github.com/users/zhongwuzw/gists{/gist_id}","starred_url":"https://api.github.com/users/zhongwuzw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhongwuzw/subscriptions","organizations_url":"https://api.github.com/users/zhongwuzw/orgs","repos_url":"https://api.github.com/users/zhongwuzw/repos","events_url":"https://api.github.com/users/zhongwuzw/events{/privacy}","received_events_url":"https://api.github.com/users/zhongwuzw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zhongwuzw/SDWebImage","description":"Asynchronous image downloader with cache support as a UIImageView category","fork":true,"url":"https://api.github.com/repos/zhongwuzw/SDWebImage","forks_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/forks","keys_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/teams","hooks_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/hooks","issue_events_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/issues/events{/number}","events_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/events","assignees_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/assignees{/user}","branches_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/branches{/branch}","tags_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/tags","blobs_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/git/refs{/sha}","trees_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/statuses/{sha}","languages_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/languages","stargazers_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/stargazers","contributors_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/contributors","subscribers_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/subscribers","subscription_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/subscription","commits_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/commits{/sha}","git_commits_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/git/commits{/sha}","comments_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/comments{/number}","issue_comment_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/issues/comments{/number}","contents_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/contents/{+path}","compare_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/merges","archive_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/downloads","issues_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/issues{/number}","pulls_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/pulls{/number}","milestones_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/milestones{/number}","notifications_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/labels{/name}","releases_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/releases{/id}","deployments_url":"https://api.github.com/repos/zhongwuzw/SDWebImage/deployments","created_at":"2018-05-21T07:46:48Z","updated_at":"2018-05-21T07:46:51Z","pushed_at":"2018-08-09T07:41:38Z","git_url":"git://github.com/zhongwuzw/SDWebImage.git","ssh_url":"git@github.com:zhongwuzw/SDWebImage.git","clone_url":"https://github.com/zhongwuzw/SDWebImage.git","svn_url":"https://github.com/zhongwuzw/SDWebImage","homepage":"http://cocoadocs.org/docsets/SDWebImage","size":10006,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rs:5.x","ref":"5.x","sha":"3b1219cdfd3ef744e8216eada263007ce19fc732","user":{"login":"rs","id":68232,"node_id":"MDQ6VXNlcjY4MjMy","avatar_url":"https://avatars2.githubusercontent.com/u/68232?v=4","gravatar_id":"","url":"https://api.github.com/users/rs","html_url":"https://github.com/rs","followers_url":"https://api.github.com/users/rs/followers","following_url":"https://api.github.com/users/rs/following{/other_user}","gists_url":"https://api.github.com/users/rs/gists{/gist_id}","starred_url":"https://api.github.com/users/rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rs/subscriptions","organizations_url":"https://api.github.com/users/rs/orgs","repos_url":"https://api.github.com/users/rs/repos","events_url":"https://api.github.com/users/rs/events{/privacy}","received_events_url":"https://api.github.com/users/rs/received_events","type":"User","site_admin":false},"repo":{"id":313419,"node_id":"MDEwOlJlcG9zaXRvcnkzMTM0MTk=","name":"SDWebImage","full_name":"rs/SDWebImage","owner":{"login":"rs","id":68232,"node_id":"MDQ6VXNlcjY4MjMy","avatar_url":"https://avatars2.githubusercontent.com/u/68232?v=4","gravatar_id":"","url":"https://api.github.com/users/rs","html_url":"https://github.com/rs","followers_url":"https://api.github.com/users/rs/followers","following_url":"https://api.github.com/users/rs/following{/other_user}","gists_url":"https://api.github.com/users/rs/gists{/gist_id}","starred_url":"https://api.github.com/users/rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rs/subscriptions","organizations_url":"https://api.github.com/users/rs/orgs","repos_url":"https://api.github.com/users/rs/repos","events_url":"https://api.github.com/users/rs/events{/privacy}","received_events_url":"https://api.github.com/users/rs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rs/SDWebImage","description":"Asynchronous image downloader with cache support as a UIImageView category","fork":false,"url":"https://api.github.com/repos/rs/SDWebImage","forks_url":"https://api.github.com/repos/rs/SDWebImage/forks","keys_url":"https://api.github.com/repos/rs/SDWebImage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rs/SDWebImage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rs/SDWebImage/teams","hooks_url":"https://api.github.com/repos/rs/SDWebImage/hooks","issue_events_url":"https://api.github.com/repos/rs/SDWebImage/issues/events{/number}","events_url":"https://api.github.com/repos/rs/SDWebImage/events","assignees_url":"https://api.github.com/repos/rs/SDWebImage/assignees{/user}","branches_url":"https://api.github.com/repos/rs/SDWebImage/branches{/branch}","tags_url":"https://api.github.com/repos/rs/SDWebImage/tags","blobs_url":"https://api.github.com/repos/rs/SDWebImage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rs/SDWebImage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rs/SDWebImage/git/refs{/sha}","trees_url":"https://api.github.com/repos/rs/SDWebImage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rs/SDWebImage/statuses/{sha}","languages_url":"https://api.github.com/repos/rs/SDWebImage/languages","stargazers_url":"https://api.github.com/repos/rs/SDWebImage/stargazers","contributors_url":"https://api.github.com/repos/rs/SDWebImage/contributors","subscribers_url":"https://api.github.com/repos/rs/SDWebImage/subscribers","subscription_url":"https://api.github.com/repos/rs/SDWebImage/subscription","commits_url":"https://api.github.com/repos/rs/SDWebImage/commits{/sha}","git_commits_url":"https://api.github.com/repos/rs/SDWebImage/git/commits{/sha}","comments_url":"https://api.github.com/repos/rs/SDWebImage/comments{/number}","issue_comment_url":"https://api.github.com/repos/rs/SDWebImage/issues/comments{/number}","contents_url":"https://api.github.com/repos/rs/SDWebImage/contents/{+path}","compare_url":"https://api.github.com/repos/rs/SDWebImage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rs/SDWebImage/merges","archive_url":"https://api.github.com/repos/rs/SDWebImage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rs/SDWebImage/downloads","issues_url":"https://api.github.com/repos/rs/SDWebImage/issues{/number}","pulls_url":"https://api.github.com/repos/rs/SDWebImage/pulls{/number}","milestones_url":"https://api.github.com/repos/rs/SDWebImage/milestones{/number}","notifications_url":"https://api.github.com/repos/rs/SDWebImage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rs/SDWebImage/labels{/name}","releases_url":"https://api.github.com/repos/rs/SDWebImage/releases{/id}","deployments_url":"https://api.github.com/repos/rs/SDWebImage/deployments","created_at":"2009-09-21T17:39:19Z","updated_at":"2018-08-09T05:46:23Z","pushed_at":"2018-08-09T07:41:48Z","git_url":"git://github.com/rs/SDWebImage.git","ssh_url":"git@github.com:rs/SDWebImage.git","clone_url":"https://github.com/rs/SDWebImage.git","svn_url":"https://github.com/rs/SDWebImage","homepage":"http://cocoadocs.org/docsets/SDWebImage","size":10002,"stargazers_count":20293,"watchers_count":20293,"language":"Objective-C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5227,"mirror_url":null,"archived":false,"open_issues_count":30,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":5227,"open_issues":30,"watchers":20293,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rs/SDWebImage/pulls/2426"},"html":{"href":"https://github.com/rs/SDWebImage/pull/2426"},"issue":{"href":"https://api.github.com/repos/rs/SDWebImage/issues/2426"},"comments":{"href":"https://api.github.com/repos/rs/SDWebImage/issues/2426/comments"},"review_comments":{"href":"https://api.github.com/repos/rs/SDWebImage/pulls/2426/comments"},"review_comment":{"href":"https://api.github.com/repos/rs/SDWebImage/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rs/SDWebImage/pulls/2426/commits"},"statuses":{"href":"https://api.github.com/repos/rs/SDWebImage/statuses/ab5b5677b2370ccf4a0317ece18aa5c63b29e979"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"dreampiggy"}}