{"action":"created","comment":{"url":"https://api.github.com/repos/Azure/sonic-swss-common/pulls/comments/84973495","pull_request_review_id":5717362,"id":84973495,"diff_hunk":"@@ -51,77 +52,94 @@ ConsumerTable::~ConsumerTable()\n     delete m_subscribe;\n }\n \n-static string pop_front(queue<RedisReply *> &q)\n-{\n-    string ret(q.front()->getContext()->str);\n-    delete q.front();\n-    q.pop();\n-    return ret;\n-}\n-\n void ConsumerTable::pop(KeyOpFieldsValuesTuple &kco)\n {\n-    string rpop_key(\"RPOP \");\n-    string rpop_value = rpop_key;\n-    string rpop_op = rpop_key;\n-\n-    multi();\n+    static std::string luaScript =\n+\n+        \"local key   = redis.call('RPOP', KEYS[1])\\n\"\n+        \"local op    = redis.call('RPOP', KEYS[2])\\n\"\n+        \"local value = redis.call('RPOP', KEYS[3])\\n\"\n+\n+        \"local dbop = op:sub(1,1)\\n\"\n+        \"op = op:sub(2)\\n\"\n+        \"local ret = {key, op}\\n\"\n+\n+        \"local jj = cjson.decode(value)\\n\"\n+\n+        \"for k,v in pairs(jj) do\\n\"\n+        \"    table.insert(ret, k)\\n\"\n+        \"    table.insert(ret, v)\\n\"\n+        \"end\\n\"\n+\n+        \"if op == 'get' or op == 'getresponse' then\\n\"\n+        \"return ret\\n\"\n+        \"end\\n\"\n+\n+        \"local keyname = KEYS[4] .. ':' .. key\\n\"\n+        \"if key == '' then\\n\"","path":"common/consumertable.cpp","position":58,"original_position":58,"commit_id":"911271b14ea6f21275843617e7c4daabc7b73bca","original_commit_id":"911271b14ea6f21275843617e7c4daabc7b73bca","user":{"login":"lguohan","id":2293967,"avatar_url":"https://avatars.githubusercontent.com/u/2293967?v=3","gravatar_id":"","url":"https://api.github.com/users/lguohan","html_url":"https://github.com/lguohan","followers_url":"https://api.github.com/users/lguohan/followers","following_url":"https://api.github.com/users/lguohan/following{/other_user}","gists_url":"https://api.github.com/users/lguohan/gists{/gist_id}","starred_url":"https://api.github.com/users/lguohan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lguohan/subscriptions","organizations_url":"https://api.github.com/users/lguohan/orgs","repos_url":"https://api.github.com/users/lguohan/repos","events_url":"https://api.github.com/users/lguohan/events{/privacy}","received_events_url":"https://api.github.com/users/lguohan/received_events","type":"User","site_admin":false},"body":"when op is set, the key is not empty string.","created_at":"2016-10-25T18:47:00Z","updated_at":"2016-10-25T18:47:00Z","html_url":"https://github.com/Azure/sonic-swss-common/pull/50#discussion_r84973495","pull_request_url":"https://api.github.com/repos/Azure/sonic-swss-common/pulls/50","_links":{"self":{"href":"https://api.github.com/repos/Azure/sonic-swss-common/pulls/comments/84973495"},"html":{"href":"https://github.com/Azure/sonic-swss-common/pull/50#discussion_r84973495"},"pull_request":{"href":"https://api.github.com/repos/Azure/sonic-swss-common/pulls/50"}}},"pull_request":{"url":"https://api.github.com/repos/Azure/sonic-swss-common/pulls/50","id":90465536,"html_url":"https://github.com/Azure/sonic-swss-common/pull/50","diff_url":"https://github.com/Azure/sonic-swss-common/pull/50.diff","patch_url":"https://github.com/Azure/sonic-swss-common/pull/50.patch","issue_url":"https://api.github.com/repos/Azure/sonic-swss-common/issues/50","number":50,"state":"open","locked":false,"title":"Make produce and consumer use LUA script","user":{"login":"kcudnik","id":17052279,"avatar_url":"https://avatars.githubusercontent.com/u/17052279?v=3","gravatar_id":"","url":"https://api.github.com/users/kcudnik","html_url":"https://github.com/kcudnik","followers_url":"https://api.github.com/users/kcudnik/followers","following_url":"https://api.github.com/users/kcudnik/following{/other_user}","gists_url":"https://api.github.com/users/kcudnik/gists{/gist_id}","starred_url":"https://api.github.com/users/kcudnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kcudnik/subscriptions","organizations_url":"https://api.github.com/users/kcudnik/orgs","repos_url":"https://api.github.com/users/kcudnik/repos","events_url":"https://api.github.com/users/kcudnik/events{/privacy}","received_events_url":"https://api.github.com/users/kcudnik/received_events","type":"User","site_admin":false},"body":"+ update compiler warnings and fix unittest","created_at":"2016-10-22T01:32:02Z","updated_at":"2016-10-25T18:47:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"357d0a07318547310d02314ab786388c6f0466b6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Azure/sonic-swss-common/pulls/50/commits","review_comments_url":"https://api.github.com/repos/Azure/sonic-swss-common/pulls/50/comments","review_comment_url":"https://api.github.com/repos/Azure/sonic-swss-common/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Azure/sonic-swss-common/issues/50/comments","statuses_url":"https://api.github.com/repos/Azure/sonic-swss-common/statuses/911271b14ea6f21275843617e7c4daabc7b73bca","head":{"label":"kcudnik:ut","ref":"ut","sha":"911271b14ea6f21275843617e7c4daabc7b73bca","user":{"login":"kcudnik","id":17052279,"avatar_url":"https://avatars.githubusercontent.com/u/17052279?v=3","gravatar_id":"","url":"https://api.github.com/users/kcudnik","html_url":"https://github.com/kcudnik","followers_url":"https://api.github.com/users/kcudnik/followers","following_url":"https://api.github.com/users/kcudnik/following{/other_user}","gists_url":"https://api.github.com/users/kcudnik/gists{/gist_id}","starred_url":"https://api.github.com/users/kcudnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kcudnik/subscriptions","organizations_url":"https://api.github.com/users/kcudnik/orgs","repos_url":"https://api.github.com/users/kcudnik/repos","events_url":"https://api.github.com/users/kcudnik/events{/privacy}","received_events_url":"https://api.github.com/users/kcudnik/received_events","type":"User","site_admin":false},"repo":{"id":55191324,"name":"sonic-swss-common","full_name":"kcudnik/sonic-swss-common","owner":{"login":"kcudnik","id":17052279,"avatar_url":"https://avatars.githubusercontent.com/u/17052279?v=3","gravatar_id":"","url":"https://api.github.com/users/kcudnik","html_url":"https://github.com/kcudnik","followers_url":"https://api.github.com/users/kcudnik/followers","following_url":"https://api.github.com/users/kcudnik/following{/other_user}","gists_url":"https://api.github.com/users/kcudnik/gists{/gist_id}","starred_url":"https://api.github.com/users/kcudnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kcudnik/subscriptions","organizations_url":"https://api.github.com/users/kcudnik/orgs","repos_url":"https://api.github.com/users/kcudnik/repos","events_url":"https://api.github.com/users/kcudnik/events{/privacy}","received_events_url":"https://api.github.com/users/kcudnik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kcudnik/sonic-swss-common","description":"Common components for SONiC switch state service","fork":true,"url":"https://api.github.com/repos/kcudnik/sonic-swss-common","forks_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/forks","keys_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/teams","hooks_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/hooks","issue_events_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/issues/events{/number}","events_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/events","assignees_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/assignees{/user}","branches_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/branches{/branch}","tags_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/tags","blobs_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/statuses/{sha}","languages_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/languages","stargazers_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/stargazers","contributors_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/contributors","subscribers_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/subscribers","subscription_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/subscription","commits_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/issues/comments{/number}","contents_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/contents/{+path}","compare_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/merges","archive_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/downloads","issues_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/issues{/number}","pulls_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/pulls{/number}","milestones_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/milestones{/number}","notifications_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/labels{/name}","releases_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/releases{/id}","deployments_url":"https://api.github.com/repos/kcudnik/sonic-swss-common/deployments","created_at":"2016-04-01T00:10:58Z","updated_at":"2016-04-01T00:10:59Z","pushed_at":"2016-10-22T01:44:09Z","git_url":"git://github.com/kcudnik/sonic-swss-common.git","ssh_url":"git@github.com:kcudnik/sonic-swss-common.git","clone_url":"https://github.com/kcudnik/sonic-swss-common.git","svn_url":"https://github.com/kcudnik/sonic-swss-common","homepage":null,"size":530,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"Azure:master","ref":"master","sha":"ca539974742fc53c94fafaf521652f160c0ab7f7","user":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"repo":{"id":54597875,"name":"sonic-swss-common","full_name":"Azure/sonic-swss-common","owner":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Azure/sonic-swss-common","description":"Common components for SONiC switch state service","fork":false,"url":"https://api.github.com/repos/Azure/sonic-swss-common","forks_url":"https://api.github.com/repos/Azure/sonic-swss-common/forks","keys_url":"https://api.github.com/repos/Azure/sonic-swss-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/sonic-swss-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/sonic-swss-common/teams","hooks_url":"https://api.github.com/repos/Azure/sonic-swss-common/hooks","issue_events_url":"https://api.github.com/repos/Azure/sonic-swss-common/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/sonic-swss-common/events","assignees_url":"https://api.github.com/repos/Azure/sonic-swss-common/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/sonic-swss-common/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/sonic-swss-common/tags","blobs_url":"https://api.github.com/repos/Azure/sonic-swss-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/sonic-swss-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/sonic-swss-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/sonic-swss-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/sonic-swss-common/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/sonic-swss-common/languages","stargazers_url":"https://api.github.com/repos/Azure/sonic-swss-common/stargazers","contributors_url":"https://api.github.com/repos/Azure/sonic-swss-common/contributors","subscribers_url":"https://api.github.com/repos/Azure/sonic-swss-common/subscribers","subscription_url":"https://api.github.com/repos/Azure/sonic-swss-common/subscription","commits_url":"https://api.github.com/repos/Azure/sonic-swss-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/sonic-swss-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/sonic-swss-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/sonic-swss-common/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/sonic-swss-common/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/sonic-swss-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/sonic-swss-common/merges","archive_url":"https://api.github.com/repos/Azure/sonic-swss-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/sonic-swss-common/downloads","issues_url":"https://api.github.com/repos/Azure/sonic-swss-common/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/sonic-swss-common/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/sonic-swss-common/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/sonic-swss-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/sonic-swss-common/labels{/name}","releases_url":"https://api.github.com/repos/Azure/sonic-swss-common/releases{/id}","deployments_url":"https://api.github.com/repos/Azure/sonic-swss-common/deployments","created_at":"2016-03-23T22:39:26Z","updated_at":"2016-09-06T21:58:13Z","pushed_at":"2016-10-22T01:44:09Z","git_url":"git://github.com/Azure/sonic-swss-common.git","ssh_url":"git@github.com:Azure/sonic-swss-common.git","clone_url":"https://github.com/Azure/sonic-swss-common.git","svn_url":"https://github.com/Azure/sonic-swss-common","homepage":null,"size":550,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":2,"forks":9,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Azure/sonic-swss-common/pulls/50"},"html":{"href":"https://github.com/Azure/sonic-swss-common/pull/50"},"issue":{"href":"https://api.github.com/repos/Azure/sonic-swss-common/issues/50"},"comments":{"href":"https://api.github.com/repos/Azure/sonic-swss-common/issues/50/comments"},"review_comments":{"href":"https://api.github.com/repos/Azure/sonic-swss-common/pulls/50/comments"},"review_comment":{"href":"https://api.github.com/repos/Azure/sonic-swss-common/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Azure/sonic-swss-common/pulls/50/commits"},"statuses":{"href":"https://api.github.com/repos/Azure/sonic-swss-common/statuses/911271b14ea6f21275843617e7c4daabc7b73bca"}}}}
{"actor":{"display_login":"lguohan"}}