{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/etcd/pulls/comments/67414961","id":67414961,"diff_hunk":"@@ -138,21 +154,42 @@ type watcherStream struct {\n }\n \n func NewWatcher(c *Client) Watcher {\n-\tctx, cancel := context.WithCancel(context.Background())\n-\tw := &watcher{\n+\treturn &watcher{\n \t\tremote:  pb.NewWatchClient(c.conn),\n+\t\tstreams: make(map[string]*watchGrpcStream),\n+\t}\n+}\n+\n+// never closes\n+var valCtxCh = make(chan struct{})\n+var zeroTime = time.Unix(0, 0)\n+\n+// ctx with only the values; never Done\n+type valCtx struct{ context.Context }\n+\n+func (vc *valCtx) Deadline() (time.Time, bool) { return zeroTime, false }\n+func (vc *valCtx) Done() <-chan struct{}       { return valCtxCh }\n+func (vc *valCtx) Err() error                  { return nil }\n+\n+func (w *watcher) newWatcherGrpcStream(inctx context.Context) *watchGrpcStream {\n+\tctx, cancel := context.WithCancel(&valCtx{inctx})","path":"clientv3/watch.go","position":82,"original_position":82,"commit_id":"d3caa85c829487915945cb47032a5fdf9e9516d1","original_commit_id":"d3caa85c829487915945cb47032a5fdf9e9516d1","user":{"login":"xiang90","id":4479947,"avatar_url":"https://avatars.githubusercontent.com/u/4479947?v=3","gravatar_id":"","url":"https://api.github.com/users/xiang90","html_url":"https://github.com/xiang90","followers_url":"https://api.github.com/users/xiang90/followers","following_url":"https://api.github.com/users/xiang90/following{/other_user}","gists_url":"https://api.github.com/users/xiang90/gists{/gist_id}","starred_url":"https://api.github.com/users/xiang90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiang90/subscriptions","organizations_url":"https://api.github.com/users/xiang90/orgs","repos_url":"https://api.github.com/users/xiang90/repos","events_url":"https://api.github.com/users/xiang90/events{/privacy}","received_events_url":"https://api.github.com/users/xiang90/received_events","type":"User","site_admin":false},"body":"why not use context.Background?","created_at":"2016-06-16T20:07:52Z","updated_at":"2016-06-16T20:07:52Z","html_url":"https://github.com/coreos/etcd/pull/5685#discussion_r67414961","pull_request_url":"https://api.github.com/repos/coreos/etcd/pulls/5685","_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd/pulls/comments/67414961"},"html":{"href":"https://github.com/coreos/etcd/pull/5685#discussion_r67414961"},"pull_request":{"href":"https://api.github.com/repos/coreos/etcd/pulls/5685"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/etcd/pulls/5685","id":74004023,"html_url":"https://github.com/coreos/etcd/pull/5685","diff_url":"https://github.com/coreos/etcd/pull/5685.diff","patch_url":"https://github.com/coreos/etcd/pull/5685.patch","issue_url":"https://api.github.com/repos/coreos/etcd/issues/5685","number":5685,"state":"open","locked":false,"title":"clientv3: watch with arbitrary ctx values","user":{"login":"heyitsanthony","id":16294350,"avatar_url":"https://avatars.githubusercontent.com/u/16294350?v=3","gravatar_id":"","url":"https://api.github.com/users/heyitsanthony","html_url":"https://github.com/heyitsanthony","followers_url":"https://api.github.com/users/heyitsanthony/followers","following_url":"https://api.github.com/users/heyitsanthony/following{/other_user}","gists_url":"https://api.github.com/users/heyitsanthony/gists{/gist_id}","starred_url":"https://api.github.com/users/heyitsanthony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heyitsanthony/subscriptions","organizations_url":"https://api.github.com/users/heyitsanthony/orgs","repos_url":"https://api.github.com/users/heyitsanthony/repos","events_url":"https://api.github.com/users/heyitsanthony/events{/privacy}","received_events_url":"https://api.github.com/users/heyitsanthony/received_events","type":"User","site_admin":false},"body":"/cc @gyuho @xiang90\r\n\r\nCaveat: unique deadlines will create unique streams since ctxs are keyed by their String()","created_at":"2016-06-16T00:04:41Z","updated_at":"2016-06-16T20:07:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0878aa089a57aed534059ffd4ec59d82a0450a83","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/coreos/etcd/pulls/5685/commits","review_comments_url":"https://api.github.com/repos/coreos/etcd/pulls/5685/comments","review_comment_url":"https://api.github.com/repos/coreos/etcd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/etcd/issues/5685/comments","statuses_url":"https://api.github.com/repos/coreos/etcd/statuses/d3caa85c829487915945cb47032a5fdf9e9516d1","head":{"label":"heyitsanthony:multictx-watcher","ref":"multictx-watcher","sha":"d3caa85c829487915945cb47032a5fdf9e9516d1","user":{"login":"heyitsanthony","id":16294350,"avatar_url":"https://avatars.githubusercontent.com/u/16294350?v=3","gravatar_id":"","url":"https://api.github.com/users/heyitsanthony","html_url":"https://github.com/heyitsanthony","followers_url":"https://api.github.com/users/heyitsanthony/followers","following_url":"https://api.github.com/users/heyitsanthony/following{/other_user}","gists_url":"https://api.github.com/users/heyitsanthony/gists{/gist_id}","starred_url":"https://api.github.com/users/heyitsanthony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heyitsanthony/subscriptions","organizations_url":"https://api.github.com/users/heyitsanthony/orgs","repos_url":"https://api.github.com/users/heyitsanthony/repos","events_url":"https://api.github.com/users/heyitsanthony/events{/privacy}","received_events_url":"https://api.github.com/users/heyitsanthony/received_events","type":"User","site_admin":false},"repo":{"id":47994854,"name":"etcd","full_name":"heyitsanthony/etcd","owner":{"login":"heyitsanthony","id":16294350,"avatar_url":"https://avatars.githubusercontent.com/u/16294350?v=3","gravatar_id":"","url":"https://api.github.com/users/heyitsanthony","html_url":"https://github.com/heyitsanthony","followers_url":"https://api.github.com/users/heyitsanthony/followers","following_url":"https://api.github.com/users/heyitsanthony/following{/other_user}","gists_url":"https://api.github.com/users/heyitsanthony/gists{/gist_id}","starred_url":"https://api.github.com/users/heyitsanthony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heyitsanthony/subscriptions","organizations_url":"https://api.github.com/users/heyitsanthony/orgs","repos_url":"https://api.github.com/users/heyitsanthony/repos","events_url":"https://api.github.com/users/heyitsanthony/events{/privacy}","received_events_url":"https://api.github.com/users/heyitsanthony/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/heyitsanthony/etcd","description":"Distributed reliable key-value store for the most critical data of a distributed system","fork":true,"url":"https://api.github.com/repos/heyitsanthony/etcd","forks_url":"https://api.github.com/repos/heyitsanthony/etcd/forks","keys_url":"https://api.github.com/repos/heyitsanthony/etcd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/heyitsanthony/etcd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/heyitsanthony/etcd/teams","hooks_url":"https://api.github.com/repos/heyitsanthony/etcd/hooks","issue_events_url":"https://api.github.com/repos/heyitsanthony/etcd/issues/events{/number}","events_url":"https://api.github.com/repos/heyitsanthony/etcd/events","assignees_url":"https://api.github.com/repos/heyitsanthony/etcd/assignees{/user}","branches_url":"https://api.github.com/repos/heyitsanthony/etcd/branches{/branch}","tags_url":"https://api.github.com/repos/heyitsanthony/etcd/tags","blobs_url":"https://api.github.com/repos/heyitsanthony/etcd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/heyitsanthony/etcd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/heyitsanthony/etcd/git/refs{/sha}","trees_url":"https://api.github.com/repos/heyitsanthony/etcd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/heyitsanthony/etcd/statuses/{sha}","languages_url":"https://api.github.com/repos/heyitsanthony/etcd/languages","stargazers_url":"https://api.github.com/repos/heyitsanthony/etcd/stargazers","contributors_url":"https://api.github.com/repos/heyitsanthony/etcd/contributors","subscribers_url":"https://api.github.com/repos/heyitsanthony/etcd/subscribers","subscription_url":"https://api.github.com/repos/heyitsanthony/etcd/subscription","commits_url":"https://api.github.com/repos/heyitsanthony/etcd/commits{/sha}","git_commits_url":"https://api.github.com/repos/heyitsanthony/etcd/git/commits{/sha}","comments_url":"https://api.github.com/repos/heyitsanthony/etcd/comments{/number}","issue_comment_url":"https://api.github.com/repos/heyitsanthony/etcd/issues/comments{/number}","contents_url":"https://api.github.com/repos/heyitsanthony/etcd/contents/{+path}","compare_url":"https://api.github.com/repos/heyitsanthony/etcd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/heyitsanthony/etcd/merges","archive_url":"https://api.github.com/repos/heyitsanthony/etcd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/heyitsanthony/etcd/downloads","issues_url":"https://api.github.com/repos/heyitsanthony/etcd/issues{/number}","pulls_url":"https://api.github.com/repos/heyitsanthony/etcd/pulls{/number}","milestones_url":"https://api.github.com/repos/heyitsanthony/etcd/milestones{/number}","notifications_url":"https://api.github.com/repos/heyitsanthony/etcd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/heyitsanthony/etcd/labels{/name}","releases_url":"https://api.github.com/repos/heyitsanthony/etcd/releases{/id}","deployments_url":"https://api.github.com/repos/heyitsanthony/etcd/deployments","created_at":"2015-12-14T18:57:05Z","updated_at":"2016-01-11T20:59:07Z","pushed_at":"2016-06-16T00:08:33Z","git_url":"git://github.com/heyitsanthony/etcd.git","ssh_url":"git@github.com:heyitsanthony/etcd.git","clone_url":"https://github.com/heyitsanthony/etcd.git","svn_url":"https://github.com/heyitsanthony/etcd","homepage":"https://coreos.com/etcd/docs/latest/","size":25549,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"coreos:master","ref":"master","sha":"555976ea848fb04040c1df6436b6e91d655338a7","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":11225014,"name":"etcd","full_name":"coreos/etcd","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/etcd","description":"Distributed reliable key-value store for the most critical data of a distributed system","fork":false,"url":"https://api.github.com/repos/coreos/etcd","forks_url":"https://api.github.com/repos/coreos/etcd/forks","keys_url":"https://api.github.com/repos/coreos/etcd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/etcd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/etcd/teams","hooks_url":"https://api.github.com/repos/coreos/etcd/hooks","issue_events_url":"https://api.github.com/repos/coreos/etcd/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/etcd/events","assignees_url":"https://api.github.com/repos/coreos/etcd/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/etcd/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/etcd/tags","blobs_url":"https://api.github.com/repos/coreos/etcd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/etcd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/etcd/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/etcd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/etcd/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/etcd/languages","stargazers_url":"https://api.github.com/repos/coreos/etcd/stargazers","contributors_url":"https://api.github.com/repos/coreos/etcd/contributors","subscribers_url":"https://api.github.com/repos/coreos/etcd/subscribers","subscription_url":"https://api.github.com/repos/coreos/etcd/subscription","commits_url":"https://api.github.com/repos/coreos/etcd/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/etcd/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/etcd/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/etcd/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/etcd/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/etcd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/etcd/merges","archive_url":"https://api.github.com/repos/coreos/etcd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/etcd/downloads","issues_url":"https://api.github.com/repos/coreos/etcd/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/etcd/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/etcd/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/etcd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/etcd/labels{/name}","releases_url":"https://api.github.com/repos/coreos/etcd/releases{/id}","deployments_url":"https://api.github.com/repos/coreos/etcd/deployments","created_at":"2013-07-06T21:57:21Z","updated_at":"2016-06-16T16:16:14Z","pushed_at":"2016-06-16T19:35:45Z","git_url":"git://github.com/coreos/etcd.git","ssh_url":"git@github.com:coreos/etcd.git","clone_url":"https://github.com/coreos/etcd.git","svn_url":"https://github.com/coreos/etcd","homepage":"https://coreos.com/etcd/docs/latest/","size":32268,"stargazers_count":9925,"watchers_count":9925,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1672,"mirror_url":null,"open_issues_count":138,"forks":1672,"open_issues":138,"watchers":9925,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd/pulls/5685"},"html":{"href":"https://github.com/coreos/etcd/pull/5685"},"issue":{"href":"https://api.github.com/repos/coreos/etcd/issues/5685"},"comments":{"href":"https://api.github.com/repos/coreos/etcd/issues/5685/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/etcd/pulls/5685/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/etcd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/etcd/pulls/5685/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/etcd/statuses/d3caa85c829487915945cb47032a5fdf9e9516d1"}}}}
{"actor":{"display_login":"xiang90"}}