{"action":"created","comment":{"url":"https://api.github.com/repos/uber/tchannel/pulls/comments/38228611","id":38228611,"diff_hunk":"@@ -548,6 +539,25 @@ function destroy() {\n     self.rateLimiter.destroy();\n };\n \n+ServiceDispatchHandler.prototype.initCircuits =\n+function initCircuits() {\n+    var self = this;\n+\n+    self.circuits = new Circuits({\n+        timeHeap: self.channel.timeHeap,\n+        timers: self.channel.timers,\n+        random: self.random,\n+        egressNodes: self.egressNodes,\n+        config: self.circuitsConfig\n+    });\n+\n+    self.circuits.circuitStateChangeEvent.on(onCircuitStateChange);\n+\n+    function onCircuitStateChange(stateChange) {","path":"node/hyperbahn/service_proxy.js","position":55,"original_position":55,"commit_id":"6bc6329847d051faf4b2c49127fe6f421d635e83","original_commit_id":"6bc6329847d051faf4b2c49127fe6f421d635e83","user":{"login":"kriskowal","id":60294,"avatar_url":"https://avatars.githubusercontent.com/u/60294?v=3","gravatar_id":"","url":"https://api.github.com/users/kriskowal","html_url":"https://github.com/kriskowal","followers_url":"https://api.github.com/users/kriskowal/followers","following_url":"https://api.github.com/users/kriskowal/following{/other_user}","gists_url":"https://api.github.com/users/kriskowal/gists{/gist_id}","starred_url":"https://api.github.com/users/kriskowal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kriskowal/subscriptions","organizations_url":"https://api.github.com/users/kriskowal/orgs","repos_url":"https://api.github.com/users/kriskowal/repos","events_url":"https://api.github.com/users/kriskowal/events{/privacy}","received_events_url":"https://api.github.com/users/kriskowal/received_events","type":"User","site_admin":false},"body":"The closure is necessary to ensure that `this` within `self.onCircuitStateChange` is bound to `self` (the dispatch handler). The same can be accomplished with `self.onCircuitStateChange.bind(self)`, but is a known performance gotcha.","created_at":"2015-08-28T18:20:53Z","updated_at":"2015-08-28T18:20:53Z","html_url":"https://github.com/uber/tchannel/pull/1237#discussion_r38228611","pull_request_url":"https://api.github.com/repos/uber/tchannel/pulls/1237","_links":{"self":{"href":"https://api.github.com/repos/uber/tchannel/pulls/comments/38228611"},"html":{"href":"https://github.com/uber/tchannel/pull/1237#discussion_r38228611"},"pull_request":{"href":"https://api.github.com/repos/uber/tchannel/pulls/1237"}}},"pull_request":{"url":"https://api.github.com/repos/uber/tchannel/pulls/1237","id":43591942,"html_url":"https://github.com/uber/tchannel/pull/1237","diff_url":"https://github.com/uber/tchannel/pull/1237.diff","patch_url":"https://github.com/uber/tchannel/pull/1237.patch","issue_url":"https://api.github.com/repos/uber/tchannel/issues/1237","number":1237,"state":"open","locked":false,"title":"Fix late initialization of circuits","user":{"login":"kriskowal","id":60294,"avatar_url":"https://avatars.githubusercontent.com/u/60294?v=3","gravatar_id":"","url":"https://api.github.com/users/kriskowal","html_url":"https://github.com/kriskowal","followers_url":"https://api.github.com/users/kriskowal/followers","following_url":"https://api.github.com/users/kriskowal/following{/other_user}","gists_url":"https://api.github.com/users/kriskowal/gists{/gist_id}","starred_url":"https://api.github.com/users/kriskowal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kriskowal/subscriptions","organizations_url":"https://api.github.com/users/kriskowal/orgs","repos_url":"https://api.github.com/users/kriskowal/repos","events_url":"https://api.github.com/users/kriskowal/events{/privacy}","received_events_url":"https://api.github.com/users/kriskowal/received_events","type":"User","site_admin":false},"body":"Previously, initializing circuits by flipping the circuit breaker on remotely would result in an uncaught exception since the circuits object would not have been initialized.\r\n\r\nr @jcorbin ","created_at":"2015-08-28T04:09:56Z","updated_at":"2015-08-28T18:20:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ce58262c210851cb0fb0f8652f50c321bf822247","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/uber/tchannel/pulls/1237/commits","review_comments_url":"https://api.github.com/repos/uber/tchannel/pulls/1237/comments","review_comment_url":"https://api.github.com/repos/uber/tchannel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uber/tchannel/issues/1237/comments","statuses_url":"https://api.github.com/repos/uber/tchannel/statuses/6bc6329847d051faf4b2c49127fe6f421d635e83","head":{"label":"uber:remote-config-circuits-init","ref":"remote-config-circuits-init","sha":"6bc6329847d051faf4b2c49127fe6f421d635e83","user":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"repo":{"id":28419663,"name":"tchannel","full_name":"uber/tchannel","owner":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uber/tchannel","description":"network multiplexing and framing protocol for RPC","fork":false,"url":"https://api.github.com/repos/uber/tchannel","forks_url":"https://api.github.com/repos/uber/tchannel/forks","keys_url":"https://api.github.com/repos/uber/tchannel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber/tchannel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber/tchannel/teams","hooks_url":"https://api.github.com/repos/uber/tchannel/hooks","issue_events_url":"https://api.github.com/repos/uber/tchannel/issues/events{/number}","events_url":"https://api.github.com/repos/uber/tchannel/events","assignees_url":"https://api.github.com/repos/uber/tchannel/assignees{/user}","branches_url":"https://api.github.com/repos/uber/tchannel/branches{/branch}","tags_url":"https://api.github.com/repos/uber/tchannel/tags","blobs_url":"https://api.github.com/repos/uber/tchannel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber/tchannel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber/tchannel/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber/tchannel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber/tchannel/statuses/{sha}","languages_url":"https://api.github.com/repos/uber/tchannel/languages","stargazers_url":"https://api.github.com/repos/uber/tchannel/stargazers","contributors_url":"https://api.github.com/repos/uber/tchannel/contributors","subscribers_url":"https://api.github.com/repos/uber/tchannel/subscribers","subscription_url":"https://api.github.com/repos/uber/tchannel/subscription","commits_url":"https://api.github.com/repos/uber/tchannel/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber/tchannel/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber/tchannel/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber/tchannel/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber/tchannel/contents/{+path}","compare_url":"https://api.github.com/repos/uber/tchannel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber/tchannel/merges","archive_url":"https://api.github.com/repos/uber/tchannel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber/tchannel/downloads","issues_url":"https://api.github.com/repos/uber/tchannel/issues{/number}","pulls_url":"https://api.github.com/repos/uber/tchannel/pulls{/number}","milestones_url":"https://api.github.com/repos/uber/tchannel/milestones{/number}","notifications_url":"https://api.github.com/repos/uber/tchannel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber/tchannel/labels{/name}","releases_url":"https://api.github.com/repos/uber/tchannel/releases{/id}","created_at":"2014-12-23T21:06:57Z","updated_at":"2015-08-28T16:53:10Z","pushed_at":"2015-08-28T18:20:53Z","git_url":"git://github.com/uber/tchannel.git","ssh_url":"git@github.com:uber/tchannel.git","clone_url":"https://github.com/uber/tchannel.git","svn_url":"https://github.com/uber/tchannel","homepage":"","size":20661,"stargazers_count":185,"watchers_count":185,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":92,"forks":20,"open_issues":92,"watchers":185,"default_branch":"master"}},"base":{"label":"uber:master","ref":"master","sha":"628b493cea14f3c419eba0a9e9cc8a6b6b5f5abf","user":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"repo":{"id":28419663,"name":"tchannel","full_name":"uber/tchannel","owner":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uber/tchannel","description":"network multiplexing and framing protocol for RPC","fork":false,"url":"https://api.github.com/repos/uber/tchannel","forks_url":"https://api.github.com/repos/uber/tchannel/forks","keys_url":"https://api.github.com/repos/uber/tchannel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber/tchannel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber/tchannel/teams","hooks_url":"https://api.github.com/repos/uber/tchannel/hooks","issue_events_url":"https://api.github.com/repos/uber/tchannel/issues/events{/number}","events_url":"https://api.github.com/repos/uber/tchannel/events","assignees_url":"https://api.github.com/repos/uber/tchannel/assignees{/user}","branches_url":"https://api.github.com/repos/uber/tchannel/branches{/branch}","tags_url":"https://api.github.com/repos/uber/tchannel/tags","blobs_url":"https://api.github.com/repos/uber/tchannel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber/tchannel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber/tchannel/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber/tchannel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber/tchannel/statuses/{sha}","languages_url":"https://api.github.com/repos/uber/tchannel/languages","stargazers_url":"https://api.github.com/repos/uber/tchannel/stargazers","contributors_url":"https://api.github.com/repos/uber/tchannel/contributors","subscribers_url":"https://api.github.com/repos/uber/tchannel/subscribers","subscription_url":"https://api.github.com/repos/uber/tchannel/subscription","commits_url":"https://api.github.com/repos/uber/tchannel/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber/tchannel/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber/tchannel/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber/tchannel/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber/tchannel/contents/{+path}","compare_url":"https://api.github.com/repos/uber/tchannel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber/tchannel/merges","archive_url":"https://api.github.com/repos/uber/tchannel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber/tchannel/downloads","issues_url":"https://api.github.com/repos/uber/tchannel/issues{/number}","pulls_url":"https://api.github.com/repos/uber/tchannel/pulls{/number}","milestones_url":"https://api.github.com/repos/uber/tchannel/milestones{/number}","notifications_url":"https://api.github.com/repos/uber/tchannel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber/tchannel/labels{/name}","releases_url":"https://api.github.com/repos/uber/tchannel/releases{/id}","created_at":"2014-12-23T21:06:57Z","updated_at":"2015-08-28T16:53:10Z","pushed_at":"2015-08-28T18:20:53Z","git_url":"git://github.com/uber/tchannel.git","ssh_url":"git@github.com:uber/tchannel.git","clone_url":"https://github.com/uber/tchannel.git","svn_url":"https://github.com/uber/tchannel","homepage":"","size":20661,"stargazers_count":185,"watchers_count":185,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":92,"forks":20,"open_issues":92,"watchers":185,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uber/tchannel/pulls/1237"},"html":{"href":"https://github.com/uber/tchannel/pull/1237"},"issue":{"href":"https://api.github.com/repos/uber/tchannel/issues/1237"},"comments":{"href":"https://api.github.com/repos/uber/tchannel/issues/1237/comments"},"review_comments":{"href":"https://api.github.com/repos/uber/tchannel/pulls/1237/comments"},"review_comment":{"href":"https://api.github.com/repos/uber/tchannel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uber/tchannel/pulls/1237/commits"},"statuses":{"href":"https://api.github.com/repos/uber/tchannel/statuses/6bc6329847d051faf4b2c49127fe6f421d635e83"}}}}