{"action":"created","comment":{"url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments/157150986","pull_request_review_id":83746209,"id":157150986,"diff_hunk":"@@ -66,12 +76,40 @@ void Server::RunCompletionQueue(\n   void* tag;\n   while (completion_queue->Next(&tag, &ok)) {\n     auto* rpc_event = static_cast<Rpc::RpcEvent*>(tag);\n-    if (auto rpc = rpc_event->rpc.lock()) {\n-      rpc->service()->HandleEvent(rpc_event->event, rpc.get(), ok);\n-    } else {\n-      LOG(WARNING) << \"Ignoring stale event.\";\n+    rpc_event->ok = ok;\n+    rpc_event->event_queue->Push(rpc_event);\n+  }\n+}\n+\n+void Server::ProcessRpcEvent(Rpc::RpcEvent* rpc_event) {\n+  if (auto rpc = rpc_event->rpc.lock()) {\n+    rpc->service()->HandleEvent(rpc_event->event, rpc.get(), rpc_event->ok);\n+  } else {\n+    LOG(WARNING) << \"Ignoring stale event.\";\n+  }\n+  delete rpc_event;\n+}\n+\n+EventQueue* Server::SelectNextEventQueueRoundRobin() {\n+  ++current_event_queue_id_;\n+  current_event_queue_id_ =\n+      current_event_queue_id_ % options_.num_event_threads;\n+  return event_queue_threads_.at(current_event_queue_id_).event_queue();\n+}\n+\n+void Server::RunEventQueue(EventQueue* event_queue) {\n+  while (!shutting_down_) {\n+    Rpc::RpcEvent* rpc_event = event_queue->PopWithTimeout(\n+        cartographer::common::FromMilliseconds(100));\n+    if (rpc_event) {\n+      ProcessRpcEvent(rpc_event);\n     }\n-    delete rpc_event;\n+  }\n+\n+  // Finish processing the rest of the items.\n+  while (Rpc::RpcEvent* rpc_event = event_queue->PopWithTimeout(\n+             cartographer::common::FromMilliseconds(100))) {\n+    ProcessRpcEvent(rpc_event);","path":"cartographer_grpc/framework/server.cc","position":86,"original_position":86,"commit_id":"2261a0e97d60caf7fed903fc52329b58c73be65c","original_commit_id":"2261a0e97d60caf7fed903fc52329b58c73be65c","user":{"login":"gaschler","id":339437,"avatar_url":"https://avatars3.githubusercontent.com/u/339437?v=4","gravatar_id":"","url":"https://api.github.com/users/gaschler","html_url":"https://github.com/gaschler","followers_url":"https://api.github.com/users/gaschler/followers","following_url":"https://api.github.com/users/gaschler/following{/other_user}","gists_url":"https://api.github.com/users/gaschler/gists{/gist_id}","starred_url":"https://api.github.com/users/gaschler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaschler/subscriptions","organizations_url":"https://api.github.com/users/gaschler/orgs","repos_url":"https://api.github.com/users/gaschler/repos","events_url":"https://api.github.com/users/gaschler/events{/privacy}","received_events_url":"https://api.github.com/users/gaschler/received_events","type":"User","site_admin":false},"body":"This doesn't necessarily terminate. Can you just return and ignore the rest if the queue blocks for a certain time?","created_at":"2017-12-15T09:05:40Z","updated_at":"2017-12-15T09:37:48Z","html_url":"https://github.com/googlecartographer/cartographer/pull/759#discussion_r157150986","pull_request_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/759","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments/157150986"},"html":{"href":"https://github.com/googlecartographer/cartographer/pull/759#discussion_r157150986"},"pull_request":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/759"}}},"pull_request":{"url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/759","id":158390797,"html_url":"https://github.com/googlecartographer/cartographer/pull/759","diff_url":"https://github.com/googlecartographer/cartographer/pull/759.diff","patch_url":"https://github.com/googlecartographer/cartographer/pull/759.patch","issue_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/759","number":759,"state":"open","locked":false,"title":"Implement EventQueues.","user":{"login":"cschuet","id":25035505,"avatar_url":"https://avatars3.githubusercontent.com/u/25035505?v=4","gravatar_id":"","url":"https://api.github.com/users/cschuet","html_url":"https://github.com/cschuet","followers_url":"https://api.github.com/users/cschuet/followers","following_url":"https://api.github.com/users/cschuet/following{/other_user}","gists_url":"https://api.github.com/users/cschuet/gists{/gist_id}","starred_url":"https://api.github.com/users/cschuet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cschuet/subscriptions","organizations_url":"https://api.github.com/users/cschuet/orgs","repos_url":"https://api.github.com/users/cschuet/repos","events_url":"https://api.github.com/users/cschuet/events{/privacy}","received_events_url":"https://api.github.com/users/cschuet/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-12-14T15:45:13Z","updated_at":"2017-12-15T09:37:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"024ff1775c178ea2b9e529ebb75a52d68d3b1750","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/759/commits","review_comments_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/759/comments","review_comment_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/759/comments","statuses_url":"https://api.github.com/repos/googlecartographer/cartographer/statuses/2261a0e97d60caf7fed903fc52329b58c73be65c","head":{"label":"cschuet:event_queue","ref":"event_queue","sha":"2261a0e97d60caf7fed903fc52329b58c73be65c","user":{"login":"cschuet","id":25035505,"avatar_url":"https://avatars3.githubusercontent.com/u/25035505?v=4","gravatar_id":"","url":"https://api.github.com/users/cschuet","html_url":"https://github.com/cschuet","followers_url":"https://api.github.com/users/cschuet/followers","following_url":"https://api.github.com/users/cschuet/following{/other_user}","gists_url":"https://api.github.com/users/cschuet/gists{/gist_id}","starred_url":"https://api.github.com/users/cschuet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cschuet/subscriptions","organizations_url":"https://api.github.com/users/cschuet/orgs","repos_url":"https://api.github.com/users/cschuet/repos","events_url":"https://api.github.com/users/cschuet/events{/privacy}","received_events_url":"https://api.github.com/users/cschuet/received_events","type":"User","site_admin":false},"repo":{"id":101299121,"name":"cartographer","full_name":"cschuet/cartographer","owner":{"login":"cschuet","id":25035505,"avatar_url":"https://avatars3.githubusercontent.com/u/25035505?v=4","gravatar_id":"","url":"https://api.github.com/users/cschuet","html_url":"https://github.com/cschuet","followers_url":"https://api.github.com/users/cschuet/followers","following_url":"https://api.github.com/users/cschuet/following{/other_user}","gists_url":"https://api.github.com/users/cschuet/gists{/gist_id}","starred_url":"https://api.github.com/users/cschuet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cschuet/subscriptions","organizations_url":"https://api.github.com/users/cschuet/orgs","repos_url":"https://api.github.com/users/cschuet/repos","events_url":"https://api.github.com/users/cschuet/events{/privacy}","received_events_url":"https://api.github.com/users/cschuet/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cschuet/cartographer","description":"Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.","fork":true,"url":"https://api.github.com/repos/cschuet/cartographer","forks_url":"https://api.github.com/repos/cschuet/cartographer/forks","keys_url":"https://api.github.com/repos/cschuet/cartographer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cschuet/cartographer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cschuet/cartographer/teams","hooks_url":"https://api.github.com/repos/cschuet/cartographer/hooks","issue_events_url":"https://api.github.com/repos/cschuet/cartographer/issues/events{/number}","events_url":"https://api.github.com/repos/cschuet/cartographer/events","assignees_url":"https://api.github.com/repos/cschuet/cartographer/assignees{/user}","branches_url":"https://api.github.com/repos/cschuet/cartographer/branches{/branch}","tags_url":"https://api.github.com/repos/cschuet/cartographer/tags","blobs_url":"https://api.github.com/repos/cschuet/cartographer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cschuet/cartographer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cschuet/cartographer/git/refs{/sha}","trees_url":"https://api.github.com/repos/cschuet/cartographer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cschuet/cartographer/statuses/{sha}","languages_url":"https://api.github.com/repos/cschuet/cartographer/languages","stargazers_url":"https://api.github.com/repos/cschuet/cartographer/stargazers","contributors_url":"https://api.github.com/repos/cschuet/cartographer/contributors","subscribers_url":"https://api.github.com/repos/cschuet/cartographer/subscribers","subscription_url":"https://api.github.com/repos/cschuet/cartographer/subscription","commits_url":"https://api.github.com/repos/cschuet/cartographer/commits{/sha}","git_commits_url":"https://api.github.com/repos/cschuet/cartographer/git/commits{/sha}","comments_url":"https://api.github.com/repos/cschuet/cartographer/comments{/number}","issue_comment_url":"https://api.github.com/repos/cschuet/cartographer/issues/comments{/number}","contents_url":"https://api.github.com/repos/cschuet/cartographer/contents/{+path}","compare_url":"https://api.github.com/repos/cschuet/cartographer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cschuet/cartographer/merges","archive_url":"https://api.github.com/repos/cschuet/cartographer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cschuet/cartographer/downloads","issues_url":"https://api.github.com/repos/cschuet/cartographer/issues{/number}","pulls_url":"https://api.github.com/repos/cschuet/cartographer/pulls{/number}","milestones_url":"https://api.github.com/repos/cschuet/cartographer/milestones{/number}","notifications_url":"https://api.github.com/repos/cschuet/cartographer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cschuet/cartographer/labels{/name}","releases_url":"https://api.github.com/repos/cschuet/cartographer/releases{/id}","deployments_url":"https://api.github.com/repos/cschuet/cartographer/deployments","created_at":"2017-08-24T13:41:15Z","updated_at":"2017-08-24T13:41:18Z","pushed_at":"2017-12-15T08:32:38Z","git_url":"git://github.com/cschuet/cartographer.git","ssh_url":"git@github.com:cschuet/cartographer.git","clone_url":"https://github.com/cschuet/cartographer.git","svn_url":"https://github.com/cschuet/cartographer","homepage":"","size":2971,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"googlecartographer:master","ref":"master","sha":"e023ec5eccfe4935a54661403a9f2d585bd9d4da","user":{"login":"googlecartographer","id":20636162,"avatar_url":"https://avatars3.githubusercontent.com/u/20636162?v=4","gravatar_id":"","url":"https://api.github.com/users/googlecartographer","html_url":"https://github.com/googlecartographer","followers_url":"https://api.github.com/users/googlecartographer/followers","following_url":"https://api.github.com/users/googlecartographer/following{/other_user}","gists_url":"https://api.github.com/users/googlecartographer/gists{/gist_id}","starred_url":"https://api.github.com/users/googlecartographer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlecartographer/subscriptions","organizations_url":"https://api.github.com/users/googlecartographer/orgs","repos_url":"https://api.github.com/users/googlecartographer/repos","events_url":"https://api.github.com/users/googlecartographer/events{/privacy}","received_events_url":"https://api.github.com/users/googlecartographer/received_events","type":"Organization","site_admin":false},"repo":{"id":64732358,"name":"cartographer","full_name":"googlecartographer/cartographer","owner":{"login":"googlecartographer","id":20636162,"avatar_url":"https://avatars3.githubusercontent.com/u/20636162?v=4","gravatar_id":"","url":"https://api.github.com/users/googlecartographer","html_url":"https://github.com/googlecartographer","followers_url":"https://api.github.com/users/googlecartographer/followers","following_url":"https://api.github.com/users/googlecartographer/following{/other_user}","gists_url":"https://api.github.com/users/googlecartographer/gists{/gist_id}","starred_url":"https://api.github.com/users/googlecartographer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlecartographer/subscriptions","organizations_url":"https://api.github.com/users/googlecartographer/orgs","repos_url":"https://api.github.com/users/googlecartographer/repos","events_url":"https://api.github.com/users/googlecartographer/events{/privacy}","received_events_url":"https://api.github.com/users/googlecartographer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/googlecartographer/cartographer","description":"Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.","fork":false,"url":"https://api.github.com/repos/googlecartographer/cartographer","forks_url":"https://api.github.com/repos/googlecartographer/cartographer/forks","keys_url":"https://api.github.com/repos/googlecartographer/cartographer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/googlecartographer/cartographer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/googlecartographer/cartographer/teams","hooks_url":"https://api.github.com/repos/googlecartographer/cartographer/hooks","issue_events_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/events{/number}","events_url":"https://api.github.com/repos/googlecartographer/cartographer/events","assignees_url":"https://api.github.com/repos/googlecartographer/cartographer/assignees{/user}","branches_url":"https://api.github.com/repos/googlecartographer/cartographer/branches{/branch}","tags_url":"https://api.github.com/repos/googlecartographer/cartographer/tags","blobs_url":"https://api.github.com/repos/googlecartographer/cartographer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/googlecartographer/cartographer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/googlecartographer/cartographer/git/refs{/sha}","trees_url":"https://api.github.com/repos/googlecartographer/cartographer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/googlecartographer/cartographer/statuses/{sha}","languages_url":"https://api.github.com/repos/googlecartographer/cartographer/languages","stargazers_url":"https://api.github.com/repos/googlecartographer/cartographer/stargazers","contributors_url":"https://api.github.com/repos/googlecartographer/cartographer/contributors","subscribers_url":"https://api.github.com/repos/googlecartographer/cartographer/subscribers","subscription_url":"https://api.github.com/repos/googlecartographer/cartographer/subscription","commits_url":"https://api.github.com/repos/googlecartographer/cartographer/commits{/sha}","git_commits_url":"https://api.github.com/repos/googlecartographer/cartographer/git/commits{/sha}","comments_url":"https://api.github.com/repos/googlecartographer/cartographer/comments{/number}","issue_comment_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/comments{/number}","contents_url":"https://api.github.com/repos/googlecartographer/cartographer/contents/{+path}","compare_url":"https://api.github.com/repos/googlecartographer/cartographer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/googlecartographer/cartographer/merges","archive_url":"https://api.github.com/repos/googlecartographer/cartographer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/googlecartographer/cartographer/downloads","issues_url":"https://api.github.com/repos/googlecartographer/cartographer/issues{/number}","pulls_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls{/number}","milestones_url":"https://api.github.com/repos/googlecartographer/cartographer/milestones{/number}","notifications_url":"https://api.github.com/repos/googlecartographer/cartographer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/googlecartographer/cartographer/labels{/name}","releases_url":"https://api.github.com/repos/googlecartographer/cartographer/releases{/id}","deployments_url":"https://api.github.com/repos/googlecartographer/cartographer/deployments","created_at":"2016-08-02T06:55:43Z","updated_at":"2017-12-14T20:14:46Z","pushed_at":"2017-12-15T08:32:39Z","git_url":"git://github.com/googlecartographer/cartographer.git","ssh_url":"git@github.com:googlecartographer/cartographer.git","clone_url":"https://github.com/googlecartographer/cartographer.git","svn_url":"https://github.com/googlecartographer/cartographer","homepage":"","size":2785,"stargazers_count":3046,"watchers_count":3046,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":939,"mirror_url":null,"archived":false,"open_issues_count":21,"license":null,"forks":939,"open_issues":21,"watchers":3046,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/759"},"html":{"href":"https://github.com/googlecartographer/cartographer/pull/759"},"issue":{"href":"https://api.github.com/repos/googlecartographer/cartographer/issues/759"},"comments":{"href":"https://api.github.com/repos/googlecartographer/cartographer/issues/759/comments"},"review_comments":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/759/comments"},"review_comment":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/759/commits"},"statuses":{"href":"https://api.github.com/repos/googlecartographer/cartographer/statuses/2261a0e97d60caf7fed903fc52329b58c73be65c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"gaschler"}}