{"action":"created","comment":{"url":"https://api.github.com/repos/reddit/baseplate/pulls/comments/269242624","pull_request_review_id":219069227,"id":269242624,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI2OTI0MjYyNA==","diff_hunk":"@@ -90,7 +96,50 @@ def make_object_for_context(self, name, server_span):\n         return cqlmapper.connection.Connection(session_adapter)\n \n \n-def _on_execute_complete(_, span):\n+class WaitForCallbackResponseFuture(object):\n+    \"\"\"Wrap the ResponseFuture to ensure callbacks have completed.\n+\n+    This fixes a race condition where the server span can complete before\n+    the callback has closed out the child span.\n+\n+    \"\"\"\n+\n+    def __init__(self, span, future, callback_fn, callback_args, errback_fn, errback_args):\n+        self.callback_event = Event()\n+\n+        def register_completion(fn):\n+            def register_after_execute(*a, **kw):\n+                try:\n+                    return fn(*a, **kw)\n+                finally:\n+                    self.callback_event.set()\n+            return register_after_execute\n+\n+        future.add_callback(register_completion(callback_fn), callback_args)\n+        future.add_errback(register_completion(errback_fn), errback_args)\n+\n+        self.future = future\n+\n+    def result(self):\n+        exc = None\n+\n+        try:\n+            result = self.future.result()\n+        except Exception as e:\n+            exc = e","path":"baseplate/context/cassandra.py","position":55,"original_position":55,"commit_id":"470199e9b8006d88bf9aaa565734571a21f2e05e","original_commit_id":"b218b7ec25e3165962ceb7c4ea52f8da31a1b939","user":{"login":"bsimpson63","id":833317,"node_id":"MDQ6VXNlcjgzMzMxNw==","avatar_url":"https://avatars1.githubusercontent.com/u/833317?v=4","gravatar_id":"","url":"https://api.github.com/users/bsimpson63","html_url":"https://github.com/bsimpson63","followers_url":"https://api.github.com/users/bsimpson63/followers","following_url":"https://api.github.com/users/bsimpson63/following{/other_user}","gists_url":"https://api.github.com/users/bsimpson63/gists{/gist_id}","starred_url":"https://api.github.com/users/bsimpson63/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsimpson63/subscriptions","organizations_url":"https://api.github.com/users/bsimpson63/orgs","repos_url":"https://api.github.com/users/bsimpson63/repos","events_url":"https://api.github.com/users/bsimpson63/events{/privacy}","received_events_url":"https://api.github.com/users/bsimpson63/received_events","type":"User","site_admin":false},"body":"hmm, this doesn't seem to work in python3. I'll hunt around for a solution","created_at":"2019-03-26T18:00:47Z","updated_at":"2019-03-26T18:00:48Z","html_url":"https://github.com/reddit/baseplate/pull/249#discussion_r269242624","pull_request_url":"https://api.github.com/repos/reddit/baseplate/pulls/249","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/reddit/baseplate/pulls/comments/269242624"},"html":{"href":"https://github.com/reddit/baseplate/pull/249#discussion_r269242624"},"pull_request":{"href":"https://api.github.com/repos/reddit/baseplate/pulls/249"}},"in_reply_to_id":269205154},"pull_request":{"url":"https://api.github.com/repos/reddit/baseplate/pulls/249","id":264558997,"node_id":"MDExOlB1bGxSZXF1ZXN0MjY0NTU4OTk3","html_url":"https://github.com/reddit/baseplate/pull/249","diff_url":"https://github.com/reddit/baseplate/pull/249.diff","patch_url":"https://github.com/reddit/baseplate/pull/249.patch","issue_url":"https://api.github.com/repos/reddit/baseplate/issues/249","number":249,"state":"open","locked":false,"title":" cassandra: Don't return from result() until callbacks have completed ","user":{"login":"bsimpson63","id":833317,"node_id":"MDQ6VXNlcjgzMzMxNw==","avatar_url":"https://avatars1.githubusercontent.com/u/833317?v=4","gravatar_id":"","url":"https://api.github.com/users/bsimpson63","html_url":"https://github.com/bsimpson63","followers_url":"https://api.github.com/users/bsimpson63/followers","following_url":"https://api.github.com/users/bsimpson63/following{/other_user}","gists_url":"https://api.github.com/users/bsimpson63/gists{/gist_id}","starred_url":"https://api.github.com/users/bsimpson63/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsimpson63/subscriptions","organizations_url":"https://api.github.com/users/bsimpson63/orgs","repos_url":"https://api.github.com/users/bsimpson63/repos","events_url":"https://api.github.com/users/bsimpson63/events{/privacy}","received_events_url":"https://api.github.com/users/bsimpson63/received_events","type":"User","site_admin":false},"body":"This fixes a race condition where the server span can complete before\r\nthe callback has closed out the child span.\r\n\r\nhttps://github.com/reddit/baseplate/issues/100\r\n\r\n👓 @spladug @bradengroom @pacejackson ","created_at":"2019-03-26T15:00:44Z","updated_at":"2019-03-26T18:00:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a7b5e28f9ca5688a10d3a6692959bb6f6fbb029","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/reddit/baseplate/pulls/249/commits","review_comments_url":"https://api.github.com/repos/reddit/baseplate/pulls/249/comments","review_comment_url":"https://api.github.com/repos/reddit/baseplate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reddit/baseplate/issues/249/comments","statuses_url":"https://api.github.com/repos/reddit/baseplate/statuses/470199e9b8006d88bf9aaa565734571a21f2e05e","head":{"label":"bsimpson63:cass-future-callback","ref":"cass-future-callback","sha":"470199e9b8006d88bf9aaa565734571a21f2e05e","user":{"login":"bsimpson63","id":833317,"node_id":"MDQ6VXNlcjgzMzMxNw==","avatar_url":"https://avatars1.githubusercontent.com/u/833317?v=4","gravatar_id":"","url":"https://api.github.com/users/bsimpson63","html_url":"https://github.com/bsimpson63","followers_url":"https://api.github.com/users/bsimpson63/followers","following_url":"https://api.github.com/users/bsimpson63/following{/other_user}","gists_url":"https://api.github.com/users/bsimpson63/gists{/gist_id}","starred_url":"https://api.github.com/users/bsimpson63/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsimpson63/subscriptions","organizations_url":"https://api.github.com/users/bsimpson63/orgs","repos_url":"https://api.github.com/users/bsimpson63/repos","events_url":"https://api.github.com/users/bsimpson63/events{/privacy}","received_events_url":"https://api.github.com/users/bsimpson63/received_events","type":"User","site_admin":false},"repo":{"id":88921166,"node_id":"MDEwOlJlcG9zaXRvcnk4ODkyMTE2Ng==","name":"baseplate","full_name":"bsimpson63/baseplate","private":false,"owner":{"login":"bsimpson63","id":833317,"node_id":"MDQ6VXNlcjgzMzMxNw==","avatar_url":"https://avatars1.githubusercontent.com/u/833317?v=4","gravatar_id":"","url":"https://api.github.com/users/bsimpson63","html_url":"https://github.com/bsimpson63","followers_url":"https://api.github.com/users/bsimpson63/followers","following_url":"https://api.github.com/users/bsimpson63/following{/other_user}","gists_url":"https://api.github.com/users/bsimpson63/gists{/gist_id}","starred_url":"https://api.github.com/users/bsimpson63/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsimpson63/subscriptions","organizations_url":"https://api.github.com/users/bsimpson63/orgs","repos_url":"https://api.github.com/users/bsimpson63/repos","events_url":"https://api.github.com/users/bsimpson63/events{/privacy}","received_events_url":"https://api.github.com/users/bsimpson63/received_events","type":"User","site_admin":false},"html_url":"https://github.com/bsimpson63/baseplate","description":"reddit's python service framework","fork":true,"url":"https://api.github.com/repos/bsimpson63/baseplate","forks_url":"https://api.github.com/repos/bsimpson63/baseplate/forks","keys_url":"https://api.github.com/repos/bsimpson63/baseplate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bsimpson63/baseplate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bsimpson63/baseplate/teams","hooks_url":"https://api.github.com/repos/bsimpson63/baseplate/hooks","issue_events_url":"https://api.github.com/repos/bsimpson63/baseplate/issues/events{/number}","events_url":"https://api.github.com/repos/bsimpson63/baseplate/events","assignees_url":"https://api.github.com/repos/bsimpson63/baseplate/assignees{/user}","branches_url":"https://api.github.com/repos/bsimpson63/baseplate/branches{/branch}","tags_url":"https://api.github.com/repos/bsimpson63/baseplate/tags","blobs_url":"https://api.github.com/repos/bsimpson63/baseplate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bsimpson63/baseplate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bsimpson63/baseplate/git/refs{/sha}","trees_url":"https://api.github.com/repos/bsimpson63/baseplate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bsimpson63/baseplate/statuses/{sha}","languages_url":"https://api.github.com/repos/bsimpson63/baseplate/languages","stargazers_url":"https://api.github.com/repos/bsimpson63/baseplate/stargazers","contributors_url":"https://api.github.com/repos/bsimpson63/baseplate/contributors","subscribers_url":"https://api.github.com/repos/bsimpson63/baseplate/subscribers","subscription_url":"https://api.github.com/repos/bsimpson63/baseplate/subscription","commits_url":"https://api.github.com/repos/bsimpson63/baseplate/commits{/sha}","git_commits_url":"https://api.github.com/repos/bsimpson63/baseplate/git/commits{/sha}","comments_url":"https://api.github.com/repos/bsimpson63/baseplate/comments{/number}","issue_comment_url":"https://api.github.com/repos/bsimpson63/baseplate/issues/comments{/number}","contents_url":"https://api.github.com/repos/bsimpson63/baseplate/contents/{+path}","compare_url":"https://api.github.com/repos/bsimpson63/baseplate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bsimpson63/baseplate/merges","archive_url":"https://api.github.com/repos/bsimpson63/baseplate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bsimpson63/baseplate/downloads","issues_url":"https://api.github.com/repos/bsimpson63/baseplate/issues{/number}","pulls_url":"https://api.github.com/repos/bsimpson63/baseplate/pulls{/number}","milestones_url":"https://api.github.com/repos/bsimpson63/baseplate/milestones{/number}","notifications_url":"https://api.github.com/repos/bsimpson63/baseplate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bsimpson63/baseplate/labels{/name}","releases_url":"https://api.github.com/repos/bsimpson63/baseplate/releases{/id}","deployments_url":"https://api.github.com/repos/bsimpson63/baseplate/deployments","created_at":"2017-04-21T00:03:12Z","updated_at":"2017-04-21T00:03:14Z","pushed_at":"2019-03-26T17:55:35Z","git_url":"git://github.com/bsimpson63/baseplate.git","ssh_url":"git@github.com:bsimpson63/baseplate.git","clone_url":"https://github.com/bsimpson63/baseplate.git","svn_url":"https://github.com/bsimpson63/baseplate","homepage":"https://reddit.github.io/baseplate/","size":1524,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"reddit:master","ref":"master","sha":"0f2cf46345ba37a088078e954f4e5edf5cc37cc9","user":{"login":"reddit","id":14248,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MjQ4","avatar_url":"https://avatars1.githubusercontent.com/u/14248?v=4","gravatar_id":"","url":"https://api.github.com/users/reddit","html_url":"https://github.com/reddit","followers_url":"https://api.github.com/users/reddit/followers","following_url":"https://api.github.com/users/reddit/following{/other_user}","gists_url":"https://api.github.com/users/reddit/gists{/gist_id}","starred_url":"https://api.github.com/users/reddit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddit/subscriptions","organizations_url":"https://api.github.com/users/reddit/orgs","repos_url":"https://api.github.com/users/reddit/repos","events_url":"https://api.github.com/users/reddit/events{/privacy}","received_events_url":"https://api.github.com/users/reddit/received_events","type":"Organization","site_admin":false},"repo":{"id":44694978,"node_id":"MDEwOlJlcG9zaXRvcnk0NDY5NDk3OA==","name":"baseplate","full_name":"reddit/baseplate","private":false,"owner":{"login":"reddit","id":14248,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MjQ4","avatar_url":"https://avatars1.githubusercontent.com/u/14248?v=4","gravatar_id":"","url":"https://api.github.com/users/reddit","html_url":"https://github.com/reddit","followers_url":"https://api.github.com/users/reddit/followers","following_url":"https://api.github.com/users/reddit/following{/other_user}","gists_url":"https://api.github.com/users/reddit/gists{/gist_id}","starred_url":"https://api.github.com/users/reddit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddit/subscriptions","organizations_url":"https://api.github.com/users/reddit/orgs","repos_url":"https://api.github.com/users/reddit/repos","events_url":"https://api.github.com/users/reddit/events{/privacy}","received_events_url":"https://api.github.com/users/reddit/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/reddit/baseplate","description":"reddit's python service framework","fork":false,"url":"https://api.github.com/repos/reddit/baseplate","forks_url":"https://api.github.com/repos/reddit/baseplate/forks","keys_url":"https://api.github.com/repos/reddit/baseplate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reddit/baseplate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reddit/baseplate/teams","hooks_url":"https://api.github.com/repos/reddit/baseplate/hooks","issue_events_url":"https://api.github.com/repos/reddit/baseplate/issues/events{/number}","events_url":"https://api.github.com/repos/reddit/baseplate/events","assignees_url":"https://api.github.com/repos/reddit/baseplate/assignees{/user}","branches_url":"https://api.github.com/repos/reddit/baseplate/branches{/branch}","tags_url":"https://api.github.com/repos/reddit/baseplate/tags","blobs_url":"https://api.github.com/repos/reddit/baseplate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reddit/baseplate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reddit/baseplate/git/refs{/sha}","trees_url":"https://api.github.com/repos/reddit/baseplate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reddit/baseplate/statuses/{sha}","languages_url":"https://api.github.com/repos/reddit/baseplate/languages","stargazers_url":"https://api.github.com/repos/reddit/baseplate/stargazers","contributors_url":"https://api.github.com/repos/reddit/baseplate/contributors","subscribers_url":"https://api.github.com/repos/reddit/baseplate/subscribers","subscription_url":"https://api.github.com/repos/reddit/baseplate/subscription","commits_url":"https://api.github.com/repos/reddit/baseplate/commits{/sha}","git_commits_url":"https://api.github.com/repos/reddit/baseplate/git/commits{/sha}","comments_url":"https://api.github.com/repos/reddit/baseplate/comments{/number}","issue_comment_url":"https://api.github.com/repos/reddit/baseplate/issues/comments{/number}","contents_url":"https://api.github.com/repos/reddit/baseplate/contents/{+path}","compare_url":"https://api.github.com/repos/reddit/baseplate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reddit/baseplate/merges","archive_url":"https://api.github.com/repos/reddit/baseplate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reddit/baseplate/downloads","issues_url":"https://api.github.com/repos/reddit/baseplate/issues{/number}","pulls_url":"https://api.github.com/repos/reddit/baseplate/pulls{/number}","milestones_url":"https://api.github.com/repos/reddit/baseplate/milestones{/number}","notifications_url":"https://api.github.com/repos/reddit/baseplate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reddit/baseplate/labels{/name}","releases_url":"https://api.github.com/repos/reddit/baseplate/releases{/id}","deployments_url":"https://api.github.com/repos/reddit/baseplate/deployments","created_at":"2015-10-21T18:07:55Z","updated_at":"2019-03-25T17:32:12Z","pushed_at":"2019-03-26T17:55:37Z","git_url":"git://github.com/reddit/baseplate.git","ssh_url":"git@github.com:reddit/baseplate.git","clone_url":"https://github.com/reddit/baseplate.git","svn_url":"https://github.com/reddit/baseplate","homepage":"https://baseplate.readthedocs.io/en/stable/","size":1517,"stargazers_count":321,"watchers_count":321,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":78,"mirror_url":null,"archived":false,"open_issues_count":35,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":78,"open_issues":35,"watchers":321,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reddit/baseplate/pulls/249"},"html":{"href":"https://github.com/reddit/baseplate/pull/249"},"issue":{"href":"https://api.github.com/repos/reddit/baseplate/issues/249"},"comments":{"href":"https://api.github.com/repos/reddit/baseplate/issues/249/comments"},"review_comments":{"href":"https://api.github.com/repos/reddit/baseplate/pulls/249/comments"},"review_comment":{"href":"https://api.github.com/repos/reddit/baseplate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reddit/baseplate/pulls/249/commits"},"statuses":{"href":"https://api.github.com/repos/reddit/baseplate/statuses/470199e9b8006d88bf9aaa565734571a21f2e05e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"bsimpson63"}}