{"action":"created","comment":{"url":"https://api.github.com/repos/samuel/go-zookeeper/pulls/comments/61062423","id":61062423,"diff_hunk":"@@ -842,6 +842,25 @@ func (c *Conn) ExistsW(path string) (bool, *Stat, <-chan Event, error) {\n \treturn exists, &res.Stat, ech, err\n }\n \n+func (c *Conn) CancelEvent(evt <-chan Event) {\n+\tc.watchersLock.Lock()\n+\tdefer c.watchersLock.Unlock()\n+\tfor pathType, watchers := range c.watchers {\n+\t\tfor idx, ch := range watchers {\n+\t\t\tif evt == ch {\n+\t\t\t\tclose(ch)\n+\t\t\t\tc.watchers[pathType] = append(watchers[:idx], watchers[idx+1:]...)\n+\t\t\t\treturn\n+\t\t\t}\n+\t\t}\n+\t}\n+\tselect {","path":"zk/conn.go","position":16,"original_position":16,"commit_id":"a2e9d0419a9c8ddbe246f8e0bff4e4e25a0e05ec","original_commit_id":"a2e9d0419a9c8ddbe246f8e0bff4e4e25a0e05ec","user":{"login":"jdef","id":2348332,"avatar_url":"https://avatars.githubusercontent.com/u/2348332?v=3","gravatar_id":"","url":"https://api.github.com/users/jdef","html_url":"https://github.com/jdef","followers_url":"https://api.github.com/users/jdef/followers","following_url":"https://api.github.com/users/jdef/following{/other_user}","gists_url":"https://api.github.com/users/jdef/gists{/gist_id}","starred_url":"https://api.github.com/users/jdef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdef/subscriptions","organizations_url":"https://api.github.com/users/jdef/orgs","repos_url":"https://api.github.com/users/jdef/repos","events_url":"https://api.github.com/users/jdef/events{/privacy}","received_events_url":"https://api.github.com/users/jdef/received_events","type":"User","site_admin":false},"body":"should this select be wrapped in a forever loop in case there are multiple events? if so, then probably want to break out of the loop if the chan is closed (to avoid busylooping)","created_at":"2016-04-26T10:22:13Z","updated_at":"2016-04-26T10:22:13Z","html_url":"https://github.com/samuel/go-zookeeper/pull/103#discussion_r61062423","pull_request_url":"https://api.github.com/repos/samuel/go-zookeeper/pulls/103","_links":{"self":{"href":"https://api.github.com/repos/samuel/go-zookeeper/pulls/comments/61062423"},"html":{"href":"https://github.com/samuel/go-zookeeper/pull/103#discussion_r61062423"},"pull_request":{"href":"https://api.github.com/repos/samuel/go-zookeeper/pulls/103"}}},"pull_request":{"url":"https://api.github.com/repos/samuel/go-zookeeper/pulls/103","id":60003096,"html_url":"https://github.com/samuel/go-zookeeper/pull/103","diff_url":"https://github.com/samuel/go-zookeeper/pull/103.diff","patch_url":"https://github.com/samuel/go-zookeeper/pull/103.patch","issue_url":"https://api.github.com/repos/samuel/go-zookeeper/issues/103","number":103,"state":"open","locked":false,"title":"adding an option to cancel an existing channel","user":{"login":"smousa","id":3171936,"avatar_url":"https://avatars.githubusercontent.com/u/3171936?v=3","gravatar_id":"","url":"https://api.github.com/users/smousa","html_url":"https://github.com/smousa","followers_url":"https://api.github.com/users/smousa/followers","following_url":"https://api.github.com/users/smousa/following{/other_user}","gists_url":"https://api.github.com/users/smousa/gists{/gist_id}","starred_url":"https://api.github.com/users/smousa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smousa/subscriptions","organizations_url":"https://api.github.com/users/smousa/orgs","repos_url":"https://api.github.com/users/smousa/repos","events_url":"https://api.github.com/users/smousa/events{/privacy}","received_events_url":"https://api.github.com/users/smousa/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-19T20:30:18Z","updated_at":"2016-04-26T10:22:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e73c45cd68b8bc147013f3022eed4f8aa2bb7717","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/samuel/go-zookeeper/pulls/103/commits","review_comments_url":"https://api.github.com/repos/samuel/go-zookeeper/pulls/103/comments","review_comment_url":"https://api.github.com/repos/samuel/go-zookeeper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/samuel/go-zookeeper/issues/103/comments","statuses_url":"https://api.github.com/repos/samuel/go-zookeeper/statuses/a2e9d0419a9c8ddbe246f8e0bff4e4e25a0e05ec","head":{"label":"smousa:feature/cancel-event","ref":"feature/cancel-event","sha":"a2e9d0419a9c8ddbe246f8e0bff4e4e25a0e05ec","user":{"login":"smousa","id":3171936,"avatar_url":"https://avatars.githubusercontent.com/u/3171936?v=3","gravatar_id":"","url":"https://api.github.com/users/smousa","html_url":"https://github.com/smousa","followers_url":"https://api.github.com/users/smousa/followers","following_url":"https://api.github.com/users/smousa/following{/other_user}","gists_url":"https://api.github.com/users/smousa/gists{/gist_id}","starred_url":"https://api.github.com/users/smousa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smousa/subscriptions","organizations_url":"https://api.github.com/users/smousa/orgs","repos_url":"https://api.github.com/users/smousa/repos","events_url":"https://api.github.com/users/smousa/events{/privacy}","received_events_url":"https://api.github.com/users/smousa/received_events","type":"User","site_admin":false},"repo":{"id":52109870,"name":"go-zookeeper","full_name":"smousa/go-zookeeper","owner":{"login":"smousa","id":3171936,"avatar_url":"https://avatars.githubusercontent.com/u/3171936?v=3","gravatar_id":"","url":"https://api.github.com/users/smousa","html_url":"https://github.com/smousa","followers_url":"https://api.github.com/users/smousa/followers","following_url":"https://api.github.com/users/smousa/following{/other_user}","gists_url":"https://api.github.com/users/smousa/gists{/gist_id}","starred_url":"https://api.github.com/users/smousa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smousa/subscriptions","organizations_url":"https://api.github.com/users/smousa/orgs","repos_url":"https://api.github.com/users/smousa/repos","events_url":"https://api.github.com/users/smousa/events{/privacy}","received_events_url":"https://api.github.com/users/smousa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/smousa/go-zookeeper","description":"Native ZooKeeper client for Go","fork":true,"url":"https://api.github.com/repos/smousa/go-zookeeper","forks_url":"https://api.github.com/repos/smousa/go-zookeeper/forks","keys_url":"https://api.github.com/repos/smousa/go-zookeeper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smousa/go-zookeeper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smousa/go-zookeeper/teams","hooks_url":"https://api.github.com/repos/smousa/go-zookeeper/hooks","issue_events_url":"https://api.github.com/repos/smousa/go-zookeeper/issues/events{/number}","events_url":"https://api.github.com/repos/smousa/go-zookeeper/events","assignees_url":"https://api.github.com/repos/smousa/go-zookeeper/assignees{/user}","branches_url":"https://api.github.com/repos/smousa/go-zookeeper/branches{/branch}","tags_url":"https://api.github.com/repos/smousa/go-zookeeper/tags","blobs_url":"https://api.github.com/repos/smousa/go-zookeeper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smousa/go-zookeeper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smousa/go-zookeeper/git/refs{/sha}","trees_url":"https://api.github.com/repos/smousa/go-zookeeper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smousa/go-zookeeper/statuses/{sha}","languages_url":"https://api.github.com/repos/smousa/go-zookeeper/languages","stargazers_url":"https://api.github.com/repos/smousa/go-zookeeper/stargazers","contributors_url":"https://api.github.com/repos/smousa/go-zookeeper/contributors","subscribers_url":"https://api.github.com/repos/smousa/go-zookeeper/subscribers","subscription_url":"https://api.github.com/repos/smousa/go-zookeeper/subscription","commits_url":"https://api.github.com/repos/smousa/go-zookeeper/commits{/sha}","git_commits_url":"https://api.github.com/repos/smousa/go-zookeeper/git/commits{/sha}","comments_url":"https://api.github.com/repos/smousa/go-zookeeper/comments{/number}","issue_comment_url":"https://api.github.com/repos/smousa/go-zookeeper/issues/comments{/number}","contents_url":"https://api.github.com/repos/smousa/go-zookeeper/contents/{+path}","compare_url":"https://api.github.com/repos/smousa/go-zookeeper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smousa/go-zookeeper/merges","archive_url":"https://api.github.com/repos/smousa/go-zookeeper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smousa/go-zookeeper/downloads","issues_url":"https://api.github.com/repos/smousa/go-zookeeper/issues{/number}","pulls_url":"https://api.github.com/repos/smousa/go-zookeeper/pulls{/number}","milestones_url":"https://api.github.com/repos/smousa/go-zookeeper/milestones{/number}","notifications_url":"https://api.github.com/repos/smousa/go-zookeeper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smousa/go-zookeeper/labels{/name}","releases_url":"https://api.github.com/repos/smousa/go-zookeeper/releases{/id}","deployments_url":"https://api.github.com/repos/smousa/go-zookeeper/deployments","created_at":"2016-02-19T19:06:10Z","updated_at":"2016-02-19T19:06:11Z","pushed_at":"2016-04-19T14:18:30Z","git_url":"git://github.com/smousa/go-zookeeper.git","ssh_url":"git@github.com:smousa/go-zookeeper.git","clone_url":"https://github.com/smousa/go-zookeeper.git","svn_url":"https://github.com/smousa/go-zookeeper","homepage":null,"size":185,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"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":"samuel:master","ref":"master","sha":"218e9c81c0dd8b3b18172b2bbfad92cc7d6db55f","user":{"login":"samuel","id":8503,"avatar_url":"https://avatars.githubusercontent.com/u/8503?v=3","gravatar_id":"","url":"https://api.github.com/users/samuel","html_url":"https://github.com/samuel","followers_url":"https://api.github.com/users/samuel/followers","following_url":"https://api.github.com/users/samuel/following{/other_user}","gists_url":"https://api.github.com/users/samuel/gists{/gist_id}","starred_url":"https://api.github.com/users/samuel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samuel/subscriptions","organizations_url":"https://api.github.com/users/samuel/orgs","repos_url":"https://api.github.com/users/samuel/repos","events_url":"https://api.github.com/users/samuel/events{/privacy}","received_events_url":"https://api.github.com/users/samuel/received_events","type":"User","site_admin":false},"repo":{"id":4767354,"name":"go-zookeeper","full_name":"samuel/go-zookeeper","owner":{"login":"samuel","id":8503,"avatar_url":"https://avatars.githubusercontent.com/u/8503?v=3","gravatar_id":"","url":"https://api.github.com/users/samuel","html_url":"https://github.com/samuel","followers_url":"https://api.github.com/users/samuel/followers","following_url":"https://api.github.com/users/samuel/following{/other_user}","gists_url":"https://api.github.com/users/samuel/gists{/gist_id}","starred_url":"https://api.github.com/users/samuel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samuel/subscriptions","organizations_url":"https://api.github.com/users/samuel/orgs","repos_url":"https://api.github.com/users/samuel/repos","events_url":"https://api.github.com/users/samuel/events{/privacy}","received_events_url":"https://api.github.com/users/samuel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/samuel/go-zookeeper","description":"Native ZooKeeper client for Go","fork":false,"url":"https://api.github.com/repos/samuel/go-zookeeper","forks_url":"https://api.github.com/repos/samuel/go-zookeeper/forks","keys_url":"https://api.github.com/repos/samuel/go-zookeeper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/samuel/go-zookeeper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/samuel/go-zookeeper/teams","hooks_url":"https://api.github.com/repos/samuel/go-zookeeper/hooks","issue_events_url":"https://api.github.com/repos/samuel/go-zookeeper/issues/events{/number}","events_url":"https://api.github.com/repos/samuel/go-zookeeper/events","assignees_url":"https://api.github.com/repos/samuel/go-zookeeper/assignees{/user}","branches_url":"https://api.github.com/repos/samuel/go-zookeeper/branches{/branch}","tags_url":"https://api.github.com/repos/samuel/go-zookeeper/tags","blobs_url":"https://api.github.com/repos/samuel/go-zookeeper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/samuel/go-zookeeper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/samuel/go-zookeeper/git/refs{/sha}","trees_url":"https://api.github.com/repos/samuel/go-zookeeper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/samuel/go-zookeeper/statuses/{sha}","languages_url":"https://api.github.com/repos/samuel/go-zookeeper/languages","stargazers_url":"https://api.github.com/repos/samuel/go-zookeeper/stargazers","contributors_url":"https://api.github.com/repos/samuel/go-zookeeper/contributors","subscribers_url":"https://api.github.com/repos/samuel/go-zookeeper/subscribers","subscription_url":"https://api.github.com/repos/samuel/go-zookeeper/subscription","commits_url":"https://api.github.com/repos/samuel/go-zookeeper/commits{/sha}","git_commits_url":"https://api.github.com/repos/samuel/go-zookeeper/git/commits{/sha}","comments_url":"https://api.github.com/repos/samuel/go-zookeeper/comments{/number}","issue_comment_url":"https://api.github.com/repos/samuel/go-zookeeper/issues/comments{/number}","contents_url":"https://api.github.com/repos/samuel/go-zookeeper/contents/{+path}","compare_url":"https://api.github.com/repos/samuel/go-zookeeper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/samuel/go-zookeeper/merges","archive_url":"https://api.github.com/repos/samuel/go-zookeeper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/samuel/go-zookeeper/downloads","issues_url":"https://api.github.com/repos/samuel/go-zookeeper/issues{/number}","pulls_url":"https://api.github.com/repos/samuel/go-zookeeper/pulls{/number}","milestones_url":"https://api.github.com/repos/samuel/go-zookeeper/milestones{/number}","notifications_url":"https://api.github.com/repos/samuel/go-zookeeper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/samuel/go-zookeeper/labels{/name}","releases_url":"https://api.github.com/repos/samuel/go-zookeeper/releases{/id}","deployments_url":"https://api.github.com/repos/samuel/go-zookeeper/deployments","created_at":"2012-06-23T20:22:18Z","updated_at":"2016-04-26T04:37:39Z","pushed_at":"2016-04-19T17:25:22Z","git_url":"git://github.com/samuel/go-zookeeper.git","ssh_url":"git@github.com:samuel/go-zookeeper.git","clone_url":"https://github.com/samuel/go-zookeeper.git","svn_url":"https://github.com/samuel/go-zookeeper","homepage":null,"size":338,"stargazers_count":399,"watchers_count":399,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":184,"mirror_url":null,"open_issues_count":48,"forks":184,"open_issues":48,"watchers":399,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/samuel/go-zookeeper/pulls/103"},"html":{"href":"https://github.com/samuel/go-zookeeper/pull/103"},"issue":{"href":"https://api.github.com/repos/samuel/go-zookeeper/issues/103"},"comments":{"href":"https://api.github.com/repos/samuel/go-zookeeper/issues/103/comments"},"review_comments":{"href":"https://api.github.com/repos/samuel/go-zookeeper/pulls/103/comments"},"review_comment":{"href":"https://api.github.com/repos/samuel/go-zookeeper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/samuel/go-zookeeper/pulls/103/commits"},"statuses":{"href":"https://api.github.com/repos/samuel/go-zookeeper/statuses/a2e9d0419a9c8ddbe246f8e0bff4e4e25a0e05ec"}}}}