{"action":"created","comment":{"url":"https://api.github.com/repos/google/physical-web/pulls/comments/66884251","id":66884251,"diff_hunk":"@@ -257,47 +257,49 @@ public void onDestroy() {\n \n   @Override\n   public void onUrlDeviceDiscovered(UrlDevice urlDevice) {\n-    mPwCollection.addUrlDevice(urlDevice);\n-    mPwCollection.fetchPwsResults(new PwsResultCallback() {\n-      long mPwsTripTimeMillis = 0;\n-\n-      @Override\n-      public void onPwsResult(PwsResult pwsResult) {\n-        PwsResult replacement = new Utils.PwsResultBuilder(pwsResult)\n-            .setPwsTripTimeMillis(pwsResult, mPwsTripTimeMillis)\n-            .build();\n-        mPwCollection.addMetadata(replacement);\n-        triggerCallback();\n-        updateNotifications();\n-      }\n-\n-      @Override\n-      public void onPwsResultAbsent(String url) {\n-        triggerCallback();\n-      }\n-\n-      @Override\n-      public void onPwsResultError(Collection<String> urls, int httpResponseCode, Exception e) {\n-        Log.d(TAG, \"PwsResultError: \" + httpResponseCode + \" \", e);\n-        triggerCallback();\n-      }\n-\n-      @Override\n-      public void onResponseReceived(long durationMillis) {\n-        mPwsTripTimeMillis = durationMillis;\n-      }\n-    }, new PwsResultIconCallback() {\n-      @Override\n-      public void onIcon(byte[] icon) {\n-        triggerCallback();\n-      }\n-\n-      @Override\n-      public void onError(int httpResponseCode, Exception e) {\n-        Log.d(TAG, \"PwsResultError: \" + httpResponseCode + \" \", e);\n-        triggerCallback();\n-      }\n-    });\n+    boolean alreadyFound = mPwCollection.addUrlDevice(urlDevice);\n+    if (!alreadyFound) {","path":"android/PhysicalWeb/app/src/main/java/org/physical_web/physicalweb/UrlDeviceDiscoveryService.java","position":46,"original_position":46,"commit_id":"8919469b7016a9bfcea09a3a5a7d6f72e9940de1","original_commit_id":"8919469b7016a9bfcea09a3a5a7d6f72e9940de1","user":{"login":"nondebug","id":14099571,"avatar_url":"https://avatars.githubusercontent.com/u/14099571?v=3","gravatar_id":"","url":"https://api.github.com/users/nondebug","html_url":"https://github.com/nondebug","followers_url":"https://api.github.com/users/nondebug/followers","following_url":"https://api.github.com/users/nondebug/following{/other_user}","gists_url":"https://api.github.com/users/nondebug/gists{/gist_id}","starred_url":"https://api.github.com/users/nondebug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nondebug/subscriptions","organizations_url":"https://api.github.com/users/nondebug/orgs","repos_url":"https://api.github.com/users/nondebug/repos","events_url":"https://api.github.com/users/nondebug/events{/privacy}","received_events_url":"https://api.github.com/users/nondebug/received_events","type":"User","site_admin":false},"body":"How about:\r\n\r\nif (mPwCollection.addUrlDevice(urlDevice)) {\r\n  // Device is already present in collection.\r\n  return;\r\n}\r\nmPwCollection.fetchPwsResults(...","created_at":"2016-06-13T23:01:54Z","updated_at":"2016-06-13T23:01:54Z","html_url":"https://github.com/google/physical-web/pull/689#discussion_r66884251","pull_request_url":"https://api.github.com/repos/google/physical-web/pulls/689","_links":{"self":{"href":"https://api.github.com/repos/google/physical-web/pulls/comments/66884251"},"html":{"href":"https://github.com/google/physical-web/pull/689#discussion_r66884251"},"pull_request":{"href":"https://api.github.com/repos/google/physical-web/pulls/689"}}},"pull_request":{"url":"https://api.github.com/repos/google/physical-web/pulls/689","id":73653677,"html_url":"https://github.com/google/physical-web/pull/689","diff_url":"https://github.com/google/physical-web/pull/689.diff","patch_url":"https://github.com/google/physical-web/pull/689.patch","issue_url":"https://api.github.com/repos/google/physical-web/issues/689","number":689,"state":"open","locked":false,"title":"Preventing Repeated Fetches and Resolves","user":{"login":"nishadg246","id":10369130,"avatar_url":"https://avatars.githubusercontent.com/u/10369130?v=3","gravatar_id":"","url":"https://api.github.com/users/nishadg246","html_url":"https://github.com/nishadg246","followers_url":"https://api.github.com/users/nishadg246/followers","following_url":"https://api.github.com/users/nishadg246/following{/other_user}","gists_url":"https://api.github.com/users/nishadg246/gists{/gist_id}","starred_url":"https://api.github.com/users/nishadg246/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nishadg246/subscriptions","organizations_url":"https://api.github.com/users/nishadg246/orgs","repos_url":"https://api.github.com/users/nishadg246/repos","events_url":"https://api.github.com/users/nishadg246/events{/privacy}","received_events_url":"https://api.github.com/users/nishadg246/received_events","type":"User","site_admin":false},"body":"When a URL is not resolved by the PWS, the client\r\nwill continue to attempt to fetch a result unnecessarily.\r\nAlso, we refetch whenever we see a new beacon rather than\r\nonly when we see a beacon not seen during the current scan","created_at":"2016-06-13T22:28:51Z","updated_at":"2016-06-13T23:01:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be226c79ecbcad48fbc0ce207d467c6870aab594","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/google/physical-web/pulls/689/commits","review_comments_url":"https://api.github.com/repos/google/physical-web/pulls/689/comments","review_comment_url":"https://api.github.com/repos/google/physical-web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/physical-web/issues/689/comments","statuses_url":"https://api.github.com/repos/google/physical-web/statuses/8919469b7016a9bfcea09a3a5a7d6f72e9940de1","head":{"label":"nishadg246:remove-repeat-fetching","ref":"remove-repeat-fetching","sha":"8919469b7016a9bfcea09a3a5a7d6f72e9940de1","user":{"login":"nishadg246","id":10369130,"avatar_url":"https://avatars.githubusercontent.com/u/10369130?v=3","gravatar_id":"","url":"https://api.github.com/users/nishadg246","html_url":"https://github.com/nishadg246","followers_url":"https://api.github.com/users/nishadg246/followers","following_url":"https://api.github.com/users/nishadg246/following{/other_user}","gists_url":"https://api.github.com/users/nishadg246/gists{/gist_id}","starred_url":"https://api.github.com/users/nishadg246/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nishadg246/subscriptions","organizations_url":"https://api.github.com/users/nishadg246/orgs","repos_url":"https://api.github.com/users/nishadg246/repos","events_url":"https://api.github.com/users/nishadg246/events{/privacy}","received_events_url":"https://api.github.com/users/nishadg246/received_events","type":"User","site_admin":false},"repo":{"id":59617356,"name":"physical-web","full_name":"nishadg246/physical-web","owner":{"login":"nishadg246","id":10369130,"avatar_url":"https://avatars.githubusercontent.com/u/10369130?v=3","gravatar_id":"","url":"https://api.github.com/users/nishadg246","html_url":"https://github.com/nishadg246","followers_url":"https://api.github.com/users/nishadg246/followers","following_url":"https://api.github.com/users/nishadg246/following{/other_user}","gists_url":"https://api.github.com/users/nishadg246/gists{/gist_id}","starred_url":"https://api.github.com/users/nishadg246/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nishadg246/subscriptions","organizations_url":"https://api.github.com/users/nishadg246/orgs","repos_url":"https://api.github.com/users/nishadg246/repos","events_url":"https://api.github.com/users/nishadg246/events{/privacy}","received_events_url":"https://api.github.com/users/nishadg246/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nishadg246/physical-web","description":"The Physical Web: walk up and use anything","fork":true,"url":"https://api.github.com/repos/nishadg246/physical-web","forks_url":"https://api.github.com/repos/nishadg246/physical-web/forks","keys_url":"https://api.github.com/repos/nishadg246/physical-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nishadg246/physical-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nishadg246/physical-web/teams","hooks_url":"https://api.github.com/repos/nishadg246/physical-web/hooks","issue_events_url":"https://api.github.com/repos/nishadg246/physical-web/issues/events{/number}","events_url":"https://api.github.com/repos/nishadg246/physical-web/events","assignees_url":"https://api.github.com/repos/nishadg246/physical-web/assignees{/user}","branches_url":"https://api.github.com/repos/nishadg246/physical-web/branches{/branch}","tags_url":"https://api.github.com/repos/nishadg246/physical-web/tags","blobs_url":"https://api.github.com/repos/nishadg246/physical-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nishadg246/physical-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nishadg246/physical-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/nishadg246/physical-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nishadg246/physical-web/statuses/{sha}","languages_url":"https://api.github.com/repos/nishadg246/physical-web/languages","stargazers_url":"https://api.github.com/repos/nishadg246/physical-web/stargazers","contributors_url":"https://api.github.com/repos/nishadg246/physical-web/contributors","subscribers_url":"https://api.github.com/repos/nishadg246/physical-web/subscribers","subscription_url":"https://api.github.com/repos/nishadg246/physical-web/subscription","commits_url":"https://api.github.com/repos/nishadg246/physical-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/nishadg246/physical-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/nishadg246/physical-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/nishadg246/physical-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/nishadg246/physical-web/contents/{+path}","compare_url":"https://api.github.com/repos/nishadg246/physical-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nishadg246/physical-web/merges","archive_url":"https://api.github.com/repos/nishadg246/physical-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nishadg246/physical-web/downloads","issues_url":"https://api.github.com/repos/nishadg246/physical-web/issues{/number}","pulls_url":"https://api.github.com/repos/nishadg246/physical-web/pulls{/number}","milestones_url":"https://api.github.com/repos/nishadg246/physical-web/milestones{/number}","notifications_url":"https://api.github.com/repos/nishadg246/physical-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nishadg246/physical-web/labels{/name}","releases_url":"https://api.github.com/repos/nishadg246/physical-web/releases{/id}","deployments_url":"https://api.github.com/repos/nishadg246/physical-web/deployments","created_at":"2016-05-25T00:11:45Z","updated_at":"2016-05-25T00:11:46Z","pushed_at":"2016-06-13T22:38:40Z","git_url":"git://github.com/nishadg246/physical-web.git","ssh_url":"git@github.com:nishadg246/physical-web.git","clone_url":"https://github.com/nishadg246/physical-web.git","svn_url":"https://github.com/nishadg246/physical-web","homepage":"http://physical-web.org","size":12326,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"00549bc5b748f1165d6ae07813804ddc4781ebf9","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":24650339,"name":"physical-web","full_name":"google/physical-web","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/physical-web","description":"The Physical Web: walk up and use anything","fork":false,"url":"https://api.github.com/repos/google/physical-web","forks_url":"https://api.github.com/repos/google/physical-web/forks","keys_url":"https://api.github.com/repos/google/physical-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/physical-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/physical-web/teams","hooks_url":"https://api.github.com/repos/google/physical-web/hooks","issue_events_url":"https://api.github.com/repos/google/physical-web/issues/events{/number}","events_url":"https://api.github.com/repos/google/physical-web/events","assignees_url":"https://api.github.com/repos/google/physical-web/assignees{/user}","branches_url":"https://api.github.com/repos/google/physical-web/branches{/branch}","tags_url":"https://api.github.com/repos/google/physical-web/tags","blobs_url":"https://api.github.com/repos/google/physical-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/physical-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/physical-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/physical-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/physical-web/statuses/{sha}","languages_url":"https://api.github.com/repos/google/physical-web/languages","stargazers_url":"https://api.github.com/repos/google/physical-web/stargazers","contributors_url":"https://api.github.com/repos/google/physical-web/contributors","subscribers_url":"https://api.github.com/repos/google/physical-web/subscribers","subscription_url":"https://api.github.com/repos/google/physical-web/subscription","commits_url":"https://api.github.com/repos/google/physical-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/physical-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/physical-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/physical-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/physical-web/contents/{+path}","compare_url":"https://api.github.com/repos/google/physical-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/physical-web/merges","archive_url":"https://api.github.com/repos/google/physical-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/physical-web/downloads","issues_url":"https://api.github.com/repos/google/physical-web/issues{/number}","pulls_url":"https://api.github.com/repos/google/physical-web/pulls{/number}","milestones_url":"https://api.github.com/repos/google/physical-web/milestones{/number}","notifications_url":"https://api.github.com/repos/google/physical-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/physical-web/labels{/name}","releases_url":"https://api.github.com/repos/google/physical-web/releases{/id}","deployments_url":"https://api.github.com/repos/google/physical-web/deployments","created_at":"2014-09-30T18:32:14Z","updated_at":"2016-06-13T22:42:15Z","pushed_at":"2016-06-13T22:38:40Z","git_url":"git://github.com/google/physical-web.git","ssh_url":"git@github.com:google/physical-web.git","clone_url":"https://github.com/google/physical-web.git","svn_url":"https://github.com/google/physical-web","homepage":"http://physical-web.org","size":13044,"stargazers_count":5420,"watchers_count":5420,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":657,"mirror_url":null,"open_issues_count":49,"forks":657,"open_issues":49,"watchers":5420,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/physical-web/pulls/689"},"html":{"href":"https://github.com/google/physical-web/pull/689"},"issue":{"href":"https://api.github.com/repos/google/physical-web/issues/689"},"comments":{"href":"https://api.github.com/repos/google/physical-web/issues/689/comments"},"review_comments":{"href":"https://api.github.com/repos/google/physical-web/pulls/689/comments"},"review_comment":{"href":"https://api.github.com/repos/google/physical-web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/physical-web/pulls/689/commits"},"statuses":{"href":"https://api.github.com/repos/google/physical-web/statuses/8919469b7016a9bfcea09a3a5a7d6f72e9940de1"}}}}
{"actor":{"display_login":"nondebug"}}