{"action":"closed","number":36,"pull_request":{"url":"https://api.github.com/repos/greencommons/commons/pulls/36","id":94108236,"html_url":"https://github.com/greencommons/commons/pull/36","diff_url":"https://github.com/greencommons/commons/pull/36.diff","patch_url":"https://github.com/greencommons/commons/pull/36.patch","issue_url":"https://api.github.com/repos/greencommons/commons/issues/36","number":36,"state":"closed","locked":false,"title":"Run Search Index actions asynchronously","user":{"login":"adarsh","id":913757,"avatar_url":"https://avatars.githubusercontent.com/u/913757?v=3","gravatar_id":"","url":"https://api.github.com/users/adarsh","html_url":"https://github.com/adarsh","followers_url":"https://api.github.com/users/adarsh/followers","following_url":"https://api.github.com/users/adarsh/following{/other_user}","gists_url":"https://api.github.com/users/adarsh/gists{/gist_id}","starred_url":"https://api.github.com/users/adarsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adarsh/subscriptions","organizations_url":"https://api.github.com/users/adarsh/orgs","repos_url":"https://api.github.com/users/adarsh/repos","events_url":"https://api.github.com/users/adarsh/events{/privacy}","received_events_url":"https://api.github.com/users/adarsh/received_events","type":"User","site_admin":false},"body":"Reason for Change\r\n=================\r\n* When we perform CRUD actions on an AR model, we want to subsequently update the search index to keep everything in sync.\r\n* That can delay the request cycle, so we should perform those activities in the background.\r\n\r\nChanges\r\n=======\r\n* Add custom callbacks instead of the stock ElasticSearch ones.\r\n* Send modified records to a `SearchIndex` service class to abstract away everything about ElasticSearch. Let it enqueue jobs or whatever it wants.\r\n* Create a general job class to add/remove records from the search index. Built it to allow for any type of AR record with `ElasticSearch::Model` mixed in.\r\n* Add `sidekiq` gem for background job processing.\r\n* Add a way to disable the callbacks via `ENV`.\r\n\r\nMinor\r\n=====\r\n* Add [`climate_control`] gem for temporarily modifying `ENV` in tests.\r\n* Use [`pry-byebug`] instead of other pry/byebug variants.\r\n* Add an RSpec tag to disable search indexing callbacks for tests.\r\n* Add an RSpec tag to exercise background jobs inline.\r\n* Allow Rubocop to have longer specs than 5 lines\r\n* Use implicit FactoryGirl calls (e.g. no need for `FactoryGirl.` all the time)\r\n* [Let RSpec infer the spec type based on the folder][1]. No need for `type: model`.\r\n\r\n[1]: https://www.relishapp.com/rspec/rspec-rails/v/3-5/docs/directory-structure\r\n\r\n[`climate_control`]: https://github.com/thoughtbot/climate_control\r\n[`pry-byebug`]: https://github.com/deivid-rodriguez/pry-byebug","created_at":"2016-11-17T06:14:38Z","updated_at":"2016-11-18T23:01:03Z","closed_at":"2016-11-18T23:01:02Z","merged_at":"2016-11-18T23:01:02Z","merge_commit_sha":"35bf700ba0fb6867a3d11dfc72ad0a88dfcd3d10","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/greencommons/commons/pulls/36/commits","review_comments_url":"https://api.github.com/repos/greencommons/commons/pulls/36/comments","review_comment_url":"https://api.github.com/repos/greencommons/commons/pulls/comments{/number}","comments_url":"https://api.github.com/repos/greencommons/commons/issues/36/comments","statuses_url":"https://api.github.com/repos/greencommons/commons/statuses/35bf700ba0fb6867a3d11dfc72ad0a88dfcd3d10","head":{"label":"greencommons:ap-async-elasticsearch-callbacks","ref":"ap-async-elasticsearch-callbacks","sha":"35bf700ba0fb6867a3d11dfc72ad0a88dfcd3d10","user":{"login":"greencommons","id":18314434,"avatar_url":"https://avatars.githubusercontent.com/u/18314434?v=3","gravatar_id":"","url":"https://api.github.com/users/greencommons","html_url":"https://github.com/greencommons","followers_url":"https://api.github.com/users/greencommons/followers","following_url":"https://api.github.com/users/greencommons/following{/other_user}","gists_url":"https://api.github.com/users/greencommons/gists{/gist_id}","starred_url":"https://api.github.com/users/greencommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greencommons/subscriptions","organizations_url":"https://api.github.com/users/greencommons/orgs","repos_url":"https://api.github.com/users/greencommons/repos","events_url":"https://api.github.com/users/greencommons/events{/privacy}","received_events_url":"https://api.github.com/users/greencommons/received_events","type":"Organization","site_admin":false},"repo":{"id":69374875,"name":"commons","full_name":"greencommons/commons","owner":{"login":"greencommons","id":18314434,"avatar_url":"https://avatars.githubusercontent.com/u/18314434?v=3","gravatar_id":"","url":"https://api.github.com/users/greencommons","html_url":"https://github.com/greencommons","followers_url":"https://api.github.com/users/greencommons/followers","following_url":"https://api.github.com/users/greencommons/following{/other_user}","gists_url":"https://api.github.com/users/greencommons/gists{/gist_id}","starred_url":"https://api.github.com/users/greencommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greencommons/subscriptions","organizations_url":"https://api.github.com/users/greencommons/orgs","repos_url":"https://api.github.com/users/greencommons/repos","events_url":"https://api.github.com/users/greencommons/events{/privacy}","received_events_url":"https://api.github.com/users/greencommons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/greencommons/commons","description":null,"fork":false,"url":"https://api.github.com/repos/greencommons/commons","forks_url":"https://api.github.com/repos/greencommons/commons/forks","keys_url":"https://api.github.com/repos/greencommons/commons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/greencommons/commons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/greencommons/commons/teams","hooks_url":"https://api.github.com/repos/greencommons/commons/hooks","issue_events_url":"https://api.github.com/repos/greencommons/commons/issues/events{/number}","events_url":"https://api.github.com/repos/greencommons/commons/events","assignees_url":"https://api.github.com/repos/greencommons/commons/assignees{/user}","branches_url":"https://api.github.com/repos/greencommons/commons/branches{/branch}","tags_url":"https://api.github.com/repos/greencommons/commons/tags","blobs_url":"https://api.github.com/repos/greencommons/commons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/greencommons/commons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/greencommons/commons/git/refs{/sha}","trees_url":"https://api.github.com/repos/greencommons/commons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/greencommons/commons/statuses/{sha}","languages_url":"https://api.github.com/repos/greencommons/commons/languages","stargazers_url":"https://api.github.com/repos/greencommons/commons/stargazers","contributors_url":"https://api.github.com/repos/greencommons/commons/contributors","subscribers_url":"https://api.github.com/repos/greencommons/commons/subscribers","subscription_url":"https://api.github.com/repos/greencommons/commons/subscription","commits_url":"https://api.github.com/repos/greencommons/commons/commits{/sha}","git_commits_url":"https://api.github.com/repos/greencommons/commons/git/commits{/sha}","comments_url":"https://api.github.com/repos/greencommons/commons/comments{/number}","issue_comment_url":"https://api.github.com/repos/greencommons/commons/issues/comments{/number}","contents_url":"https://api.github.com/repos/greencommons/commons/contents/{+path}","compare_url":"https://api.github.com/repos/greencommons/commons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/greencommons/commons/merges","archive_url":"https://api.github.com/repos/greencommons/commons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/greencommons/commons/downloads","issues_url":"https://api.github.com/repos/greencommons/commons/issues{/number}","pulls_url":"https://api.github.com/repos/greencommons/commons/pulls{/number}","milestones_url":"https://api.github.com/repos/greencommons/commons/milestones{/number}","notifications_url":"https://api.github.com/repos/greencommons/commons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/greencommons/commons/labels{/name}","releases_url":"https://api.github.com/repos/greencommons/commons/releases{/id}","deployments_url":"https://api.github.com/repos/greencommons/commons/deployments","created_at":"2016-09-27T16:07:48Z","updated_at":"2016-10-28T15:52:11Z","pushed_at":"2016-11-18T23:01:02Z","git_url":"git://github.com/greencommons/commons.git","ssh_url":"git@github.com:greencommons/commons.git","clone_url":"https://github.com/greencommons/commons.git","svn_url":"https://github.com/greencommons/commons","homepage":null,"size":106,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":2,"default_branch":"master"}},"base":{"label":"greencommons:master","ref":"master","sha":"821185d2ebc604c7444677b4f8e0986f235749ac","user":{"login":"greencommons","id":18314434,"avatar_url":"https://avatars.githubusercontent.com/u/18314434?v=3","gravatar_id":"","url":"https://api.github.com/users/greencommons","html_url":"https://github.com/greencommons","followers_url":"https://api.github.com/users/greencommons/followers","following_url":"https://api.github.com/users/greencommons/following{/other_user}","gists_url":"https://api.github.com/users/greencommons/gists{/gist_id}","starred_url":"https://api.github.com/users/greencommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greencommons/subscriptions","organizations_url":"https://api.github.com/users/greencommons/orgs","repos_url":"https://api.github.com/users/greencommons/repos","events_url":"https://api.github.com/users/greencommons/events{/privacy}","received_events_url":"https://api.github.com/users/greencommons/received_events","type":"Organization","site_admin":false},"repo":{"id":69374875,"name":"commons","full_name":"greencommons/commons","owner":{"login":"greencommons","id":18314434,"avatar_url":"https://avatars.githubusercontent.com/u/18314434?v=3","gravatar_id":"","url":"https://api.github.com/users/greencommons","html_url":"https://github.com/greencommons","followers_url":"https://api.github.com/users/greencommons/followers","following_url":"https://api.github.com/users/greencommons/following{/other_user}","gists_url":"https://api.github.com/users/greencommons/gists{/gist_id}","starred_url":"https://api.github.com/users/greencommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greencommons/subscriptions","organizations_url":"https://api.github.com/users/greencommons/orgs","repos_url":"https://api.github.com/users/greencommons/repos","events_url":"https://api.github.com/users/greencommons/events{/privacy}","received_events_url":"https://api.github.com/users/greencommons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/greencommons/commons","description":null,"fork":false,"url":"https://api.github.com/repos/greencommons/commons","forks_url":"https://api.github.com/repos/greencommons/commons/forks","keys_url":"https://api.github.com/repos/greencommons/commons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/greencommons/commons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/greencommons/commons/teams","hooks_url":"https://api.github.com/repos/greencommons/commons/hooks","issue_events_url":"https://api.github.com/repos/greencommons/commons/issues/events{/number}","events_url":"https://api.github.com/repos/greencommons/commons/events","assignees_url":"https://api.github.com/repos/greencommons/commons/assignees{/user}","branches_url":"https://api.github.com/repos/greencommons/commons/branches{/branch}","tags_url":"https://api.github.com/repos/greencommons/commons/tags","blobs_url":"https://api.github.com/repos/greencommons/commons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/greencommons/commons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/greencommons/commons/git/refs{/sha}","trees_url":"https://api.github.com/repos/greencommons/commons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/greencommons/commons/statuses/{sha}","languages_url":"https://api.github.com/repos/greencommons/commons/languages","stargazers_url":"https://api.github.com/repos/greencommons/commons/stargazers","contributors_url":"https://api.github.com/repos/greencommons/commons/contributors","subscribers_url":"https://api.github.com/repos/greencommons/commons/subscribers","subscription_url":"https://api.github.com/repos/greencommons/commons/subscription","commits_url":"https://api.github.com/repos/greencommons/commons/commits{/sha}","git_commits_url":"https://api.github.com/repos/greencommons/commons/git/commits{/sha}","comments_url":"https://api.github.com/repos/greencommons/commons/comments{/number}","issue_comment_url":"https://api.github.com/repos/greencommons/commons/issues/comments{/number}","contents_url":"https://api.github.com/repos/greencommons/commons/contents/{+path}","compare_url":"https://api.github.com/repos/greencommons/commons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/greencommons/commons/merges","archive_url":"https://api.github.com/repos/greencommons/commons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/greencommons/commons/downloads","issues_url":"https://api.github.com/repos/greencommons/commons/issues{/number}","pulls_url":"https://api.github.com/repos/greencommons/commons/pulls{/number}","milestones_url":"https://api.github.com/repos/greencommons/commons/milestones{/number}","notifications_url":"https://api.github.com/repos/greencommons/commons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/greencommons/commons/labels{/name}","releases_url":"https://api.github.com/repos/greencommons/commons/releases{/id}","deployments_url":"https://api.github.com/repos/greencommons/commons/deployments","created_at":"2016-09-27T16:07:48Z","updated_at":"2016-10-28T15:52:11Z","pushed_at":"2016-11-18T23:01:02Z","git_url":"git://github.com/greencommons/commons.git","ssh_url":"git@github.com:greencommons/commons.git","clone_url":"https://github.com/greencommons/commons.git","svn_url":"https://github.com/greencommons/commons","homepage":null,"size":106,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/greencommons/commons/pulls/36"},"html":{"href":"https://github.com/greencommons/commons/pull/36"},"issue":{"href":"https://api.github.com/repos/greencommons/commons/issues/36"},"comments":{"href":"https://api.github.com/repos/greencommons/commons/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/greencommons/commons/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/greencommons/commons/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/greencommons/commons/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/greencommons/commons/statuses/35bf700ba0fb6867a3d11dfc72ad0a88dfcd3d10"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"adarsh","id":913757,"avatar_url":"https://avatars.githubusercontent.com/u/913757?v=3","gravatar_id":"","url":"https://api.github.com/users/adarsh","html_url":"https://github.com/adarsh","followers_url":"https://api.github.com/users/adarsh/followers","following_url":"https://api.github.com/users/adarsh/following{/other_user}","gists_url":"https://api.github.com/users/adarsh/gists{/gist_id}","starred_url":"https://api.github.com/users/adarsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adarsh/subscriptions","organizations_url":"https://api.github.com/users/adarsh/orgs","repos_url":"https://api.github.com/users/adarsh/repos","events_url":"https://api.github.com/users/adarsh/events{/privacy}","received_events_url":"https://api.github.com/users/adarsh/received_events","type":"User","site_admin":false},"comments":1,"review_comments":11,"commits":1,"additions":238,"deletions":73,"changed_files":15}}
{"actor":{"display_login":"adarsh"}}