{"action":"created","comment":{"url":"https://api.github.com/repos/30x/apidAnalytics/pulls/comments/108737429","pull_request_review_id":29788889,"id":108737429,"diff_hunk":"@@ -200,3 +209,29 @@ func createDirectories(directories []string) error {\n \t}\n \treturn nil\n }\n+\n+func shutdownPlugin() {\n+\tlog.Info(\"Shutting down apidAnalytics plugin\")\n+\n+\t// Close all open files and move directories in tmp to staging.\n+\tbucketMaplock.RLock()\n+\tdefer bucketMaplock.RUnlock()","path":"init.go","position":26,"original_position":26,"commit_id":"9607219dfb691178f11025c9cfd0b539814dcd55","original_commit_id":"b9ccfb6637f854673233202dc58fc843c64f2191","user":{"login":"haomingzhang","id":20307551,"avatar_url":"https://avatars2.githubusercontent.com/u/20307551?v=3","gravatar_id":"","url":"https://api.github.com/users/haomingzhang","html_url":"https://github.com/haomingzhang","followers_url":"https://api.github.com/users/haomingzhang/followers","following_url":"https://api.github.com/users/haomingzhang/following{/other_user}","gists_url":"https://api.github.com/users/haomingzhang/gists{/gist_id}","starred_url":"https://api.github.com/users/haomingzhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haomingzhang/subscriptions","organizations_url":"https://api.github.com/users/haomingzhang/orgs","repos_url":"https://api.github.com/users/haomingzhang/repos","events_url":"https://api.github.com/users/haomingzhang/events{/privacy}","received_events_url":"https://api.github.com/users/haomingzhang/received_events","type":"User","site_admin":false},"body":"deadlock here, don't use `defer`, please check the following comments for details.","created_at":"2017-03-29T17:28:56Z","updated_at":"2017-03-29T17:33:22Z","html_url":"https://github.com/30x/apidAnalytics/pull/11#discussion_r108737429","pull_request_url":"https://api.github.com/repos/30x/apidAnalytics/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/30x/apidAnalytics/pulls/comments/108737429"},"html":{"href":"https://github.com/30x/apidAnalytics/pull/11#discussion_r108737429"},"pull_request":{"href":"https://api.github.com/repos/30x/apidAnalytics/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/30x/apidAnalytics/pulls/11","id":113060553,"html_url":"https://github.com/30x/apidAnalytics/pull/11","diff_url":"https://github.com/30x/apidAnalytics/pull/11.diff","patch_url":"https://github.com/30x/apidAnalytics/pull/11.patch","issue_url":"https://api.github.com/repos/30x/apidAnalytics/issues/11","number":11,"state":"open","locked":false,"title":"[XAPID-854] Listen to Apid shutdown, register callback and do a clean shutdown by closing open files","user":{"login":"pjain404","id":10931753,"avatar_url":"https://avatars0.githubusercontent.com/u/10931753?v=3","gravatar_id":"","url":"https://api.github.com/users/pjain404","html_url":"https://github.com/pjain404","followers_url":"https://api.github.com/users/pjain404/followers","following_url":"https://api.github.com/users/pjain404/following{/other_user}","gists_url":"https://api.github.com/users/pjain404/gists{/gist_id}","starred_url":"https://api.github.com/users/pjain404/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjain404/subscriptions","organizations_url":"https://api.github.com/users/pjain404/orgs","repos_url":"https://api.github.com/users/pjain404/repos","events_url":"https://api.github.com/users/pjain404/events{/privacy}","received_events_url":"https://api.github.com/users/pjain404/received_events","type":"User","site_admin":false},"body":"- On initialization create a listener for apidShutdownEvent and register a callback\r\n- On event reception, the plugin closes all open files and moves it to staging.\r\n- since bucketMap can be written and read from simultaneously now, Added a RWmutex to acquire locks while accessing the map","created_at":"2017-03-28T20:33:06Z","updated_at":"2017-03-29T17:33:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9ab8a6534487ddba49da53ce520941be75a119f3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/30x/apidAnalytics/pulls/11/commits","review_comments_url":"https://api.github.com/repos/30x/apidAnalytics/pulls/11/comments","review_comment_url":"https://api.github.com/repos/30x/apidAnalytics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/30x/apidAnalytics/issues/11/comments","statuses_url":"https://api.github.com/repos/30x/apidAnalytics/statuses/9607219dfb691178f11025c9cfd0b539814dcd55","head":{"label":"30x:pooja_xapid_854","ref":"pooja_xapid_854","sha":"9607219dfb691178f11025c9cfd0b539814dcd55","user":{"login":"30x","id":16658248,"avatar_url":"https://avatars0.githubusercontent.com/u/16658248?v=3","gravatar_id":"","url":"https://api.github.com/users/30x","html_url":"https://github.com/30x","followers_url":"https://api.github.com/users/30x/followers","following_url":"https://api.github.com/users/30x/following{/other_user}","gists_url":"https://api.github.com/users/30x/gists{/gist_id}","starred_url":"https://api.github.com/users/30x/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/30x/subscriptions","organizations_url":"https://api.github.com/users/30x/orgs","repos_url":"https://api.github.com/users/30x/repos","events_url":"https://api.github.com/users/30x/events{/privacy}","received_events_url":"https://api.github.com/users/30x/received_events","type":"Organization","site_admin":false},"repo":{"id":78158392,"name":"apidAnalytics","full_name":"30x/apidAnalytics","owner":{"login":"30x","id":16658248,"avatar_url":"https://avatars0.githubusercontent.com/u/16658248?v=3","gravatar_id":"","url":"https://api.github.com/users/30x","html_url":"https://github.com/30x","followers_url":"https://api.github.com/users/30x/followers","following_url":"https://api.github.com/users/30x/following{/other_user}","gists_url":"https://api.github.com/users/30x/gists{/gist_id}","starred_url":"https://api.github.com/users/30x/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/30x/subscriptions","organizations_url":"https://api.github.com/users/30x/orgs","repos_url":"https://api.github.com/users/30x/repos","events_url":"https://api.github.com/users/30x/events{/privacy}","received_events_url":"https://api.github.com/users/30x/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/30x/apidAnalytics","description":null,"fork":false,"url":"https://api.github.com/repos/30x/apidAnalytics","forks_url":"https://api.github.com/repos/30x/apidAnalytics/forks","keys_url":"https://api.github.com/repos/30x/apidAnalytics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/30x/apidAnalytics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/30x/apidAnalytics/teams","hooks_url":"https://api.github.com/repos/30x/apidAnalytics/hooks","issue_events_url":"https://api.github.com/repos/30x/apidAnalytics/issues/events{/number}","events_url":"https://api.github.com/repos/30x/apidAnalytics/events","assignees_url":"https://api.github.com/repos/30x/apidAnalytics/assignees{/user}","branches_url":"https://api.github.com/repos/30x/apidAnalytics/branches{/branch}","tags_url":"https://api.github.com/repos/30x/apidAnalytics/tags","blobs_url":"https://api.github.com/repos/30x/apidAnalytics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/30x/apidAnalytics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/30x/apidAnalytics/git/refs{/sha}","trees_url":"https://api.github.com/repos/30x/apidAnalytics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/30x/apidAnalytics/statuses/{sha}","languages_url":"https://api.github.com/repos/30x/apidAnalytics/languages","stargazers_url":"https://api.github.com/repos/30x/apidAnalytics/stargazers","contributors_url":"https://api.github.com/repos/30x/apidAnalytics/contributors","subscribers_url":"https://api.github.com/repos/30x/apidAnalytics/subscribers","subscription_url":"https://api.github.com/repos/30x/apidAnalytics/subscription","commits_url":"https://api.github.com/repos/30x/apidAnalytics/commits{/sha}","git_commits_url":"https://api.github.com/repos/30x/apidAnalytics/git/commits{/sha}","comments_url":"https://api.github.com/repos/30x/apidAnalytics/comments{/number}","issue_comment_url":"https://api.github.com/repos/30x/apidAnalytics/issues/comments{/number}","contents_url":"https://api.github.com/repos/30x/apidAnalytics/contents/{+path}","compare_url":"https://api.github.com/repos/30x/apidAnalytics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/30x/apidAnalytics/merges","archive_url":"https://api.github.com/repos/30x/apidAnalytics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/30x/apidAnalytics/downloads","issues_url":"https://api.github.com/repos/30x/apidAnalytics/issues{/number}","pulls_url":"https://api.github.com/repos/30x/apidAnalytics/pulls{/number}","milestones_url":"https://api.github.com/repos/30x/apidAnalytics/milestones{/number}","notifications_url":"https://api.github.com/repos/30x/apidAnalytics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/30x/apidAnalytics/labels{/name}","releases_url":"https://api.github.com/repos/30x/apidAnalytics/releases{/id}","deployments_url":"https://api.github.com/repos/30x/apidAnalytics/deployments","created_at":"2017-01-06T00:06:22Z","updated_at":"2017-02-07T19:34:56Z","pushed_at":"2017-03-28T20:42:25Z","git_url":"git://github.com/30x/apidAnalytics.git","ssh_url":"git@github.com:30x/apidAnalytics.git","clone_url":"https://github.com/30x/apidAnalytics.git","svn_url":"https://github.com/30x/apidAnalytics","homepage":null,"size":68,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"30x:master","ref":"master","sha":"92bef6643359fe58ace63ae6da63a8c1d31e7b81","user":{"login":"30x","id":16658248,"avatar_url":"https://avatars0.githubusercontent.com/u/16658248?v=3","gravatar_id":"","url":"https://api.github.com/users/30x","html_url":"https://github.com/30x","followers_url":"https://api.github.com/users/30x/followers","following_url":"https://api.github.com/users/30x/following{/other_user}","gists_url":"https://api.github.com/users/30x/gists{/gist_id}","starred_url":"https://api.github.com/users/30x/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/30x/subscriptions","organizations_url":"https://api.github.com/users/30x/orgs","repos_url":"https://api.github.com/users/30x/repos","events_url":"https://api.github.com/users/30x/events{/privacy}","received_events_url":"https://api.github.com/users/30x/received_events","type":"Organization","site_admin":false},"repo":{"id":78158392,"name":"apidAnalytics","full_name":"30x/apidAnalytics","owner":{"login":"30x","id":16658248,"avatar_url":"https://avatars0.githubusercontent.com/u/16658248?v=3","gravatar_id":"","url":"https://api.github.com/users/30x","html_url":"https://github.com/30x","followers_url":"https://api.github.com/users/30x/followers","following_url":"https://api.github.com/users/30x/following{/other_user}","gists_url":"https://api.github.com/users/30x/gists{/gist_id}","starred_url":"https://api.github.com/users/30x/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/30x/subscriptions","organizations_url":"https://api.github.com/users/30x/orgs","repos_url":"https://api.github.com/users/30x/repos","events_url":"https://api.github.com/users/30x/events{/privacy}","received_events_url":"https://api.github.com/users/30x/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/30x/apidAnalytics","description":null,"fork":false,"url":"https://api.github.com/repos/30x/apidAnalytics","forks_url":"https://api.github.com/repos/30x/apidAnalytics/forks","keys_url":"https://api.github.com/repos/30x/apidAnalytics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/30x/apidAnalytics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/30x/apidAnalytics/teams","hooks_url":"https://api.github.com/repos/30x/apidAnalytics/hooks","issue_events_url":"https://api.github.com/repos/30x/apidAnalytics/issues/events{/number}","events_url":"https://api.github.com/repos/30x/apidAnalytics/events","assignees_url":"https://api.github.com/repos/30x/apidAnalytics/assignees{/user}","branches_url":"https://api.github.com/repos/30x/apidAnalytics/branches{/branch}","tags_url":"https://api.github.com/repos/30x/apidAnalytics/tags","blobs_url":"https://api.github.com/repos/30x/apidAnalytics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/30x/apidAnalytics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/30x/apidAnalytics/git/refs{/sha}","trees_url":"https://api.github.com/repos/30x/apidAnalytics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/30x/apidAnalytics/statuses/{sha}","languages_url":"https://api.github.com/repos/30x/apidAnalytics/languages","stargazers_url":"https://api.github.com/repos/30x/apidAnalytics/stargazers","contributors_url":"https://api.github.com/repos/30x/apidAnalytics/contributors","subscribers_url":"https://api.github.com/repos/30x/apidAnalytics/subscribers","subscription_url":"https://api.github.com/repos/30x/apidAnalytics/subscription","commits_url":"https://api.github.com/repos/30x/apidAnalytics/commits{/sha}","git_commits_url":"https://api.github.com/repos/30x/apidAnalytics/git/commits{/sha}","comments_url":"https://api.github.com/repos/30x/apidAnalytics/comments{/number}","issue_comment_url":"https://api.github.com/repos/30x/apidAnalytics/issues/comments{/number}","contents_url":"https://api.github.com/repos/30x/apidAnalytics/contents/{+path}","compare_url":"https://api.github.com/repos/30x/apidAnalytics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/30x/apidAnalytics/merges","archive_url":"https://api.github.com/repos/30x/apidAnalytics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/30x/apidAnalytics/downloads","issues_url":"https://api.github.com/repos/30x/apidAnalytics/issues{/number}","pulls_url":"https://api.github.com/repos/30x/apidAnalytics/pulls{/number}","milestones_url":"https://api.github.com/repos/30x/apidAnalytics/milestones{/number}","notifications_url":"https://api.github.com/repos/30x/apidAnalytics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/30x/apidAnalytics/labels{/name}","releases_url":"https://api.github.com/repos/30x/apidAnalytics/releases{/id}","deployments_url":"https://api.github.com/repos/30x/apidAnalytics/deployments","created_at":"2017-01-06T00:06:22Z","updated_at":"2017-02-07T19:34:56Z","pushed_at":"2017-03-28T20:42:25Z","git_url":"git://github.com/30x/apidAnalytics.git","ssh_url":"git@github.com:30x/apidAnalytics.git","clone_url":"https://github.com/30x/apidAnalytics.git","svn_url":"https://github.com/30x/apidAnalytics","homepage":null,"size":68,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/30x/apidAnalytics/pulls/11"},"html":{"href":"https://github.com/30x/apidAnalytics/pull/11"},"issue":{"href":"https://api.github.com/repos/30x/apidAnalytics/issues/11"},"comments":{"href":"https://api.github.com/repos/30x/apidAnalytics/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/30x/apidAnalytics/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/30x/apidAnalytics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/30x/apidAnalytics/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/30x/apidAnalytics/statuses/9607219dfb691178f11025c9cfd0b539814dcd55"}}}}
{"actor":{"display_login":"haomingzhang"}}