{"action":"created","comment":{"url":"https://api.github.com/repos/zdogma/nicore/pulls/comments/33894491","id":33894491,"diff_hunk":"@@ -0,0 +1,54 @@\n+namespace :ranking_updater do\n+  desc 'ranking_idを引数に新着ランキングを更新する'\n+  task :update_newly_arrived_by_ranking_id, [:ranking_id, :batch] => :environment do |task, args|\n+    RANKING_SIZE           = 100\n+    # test mode is 10 sec but production is 24 * 60 * 60\n+    EXEC_THRESHOLD_SECONDS = 10","path":"lib/tasks/ranking_updater.rake","position":6,"original_position":6,"commit_id":"2bea9f79b59ebd593539fee71375f3143d07658b","original_commit_id":"64c95af985c18e314d2bf5d2772f0992eab3b6b6","user":{"login":"t-hrhs","id":4661349,"avatar_url":"https://avatars.githubusercontent.com/u/4661349?v=3","gravatar_id":"","url":"https://api.github.com/users/t-hrhs","html_url":"https://github.com/t-hrhs","followers_url":"https://api.github.com/users/t-hrhs/followers","following_url":"https://api.github.com/users/t-hrhs/following{/other_user}","gists_url":"https://api.github.com/users/t-hrhs/gists{/gist_id}","starred_url":"https://api.github.com/users/t-hrhs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t-hrhs/subscriptions","organizations_url":"https://api.github.com/users/t-hrhs/orgs","repos_url":"https://api.github.com/users/t-hrhs/repos","events_url":"https://api.github.com/users/t-hrhs/events{/privacy}","received_events_url":"https://api.github.com/users/t-hrhs/received_events","type":"User","site_admin":false},"body":"今後ですが、update_all_rankingをhourlyで走らせようかなと…不要な奴はそのまま期間外だよで返して終わらせたい…","created_at":"2015-07-05T12:34:01Z","updated_at":"2015-07-05T12:34:01Z","html_url":"https://github.com/zdogma/nicore/pull/18#discussion_r33894491","pull_request_url":"https://api.github.com/repos/zdogma/nicore/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/zdogma/nicore/pulls/comments/33894491"},"html":{"href":"https://github.com/zdogma/nicore/pull/18#discussion_r33894491"},"pull_request":{"href":"https://api.github.com/repos/zdogma/nicore/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/zdogma/nicore/pulls/18","id":38720637,"html_url":"https://github.com/zdogma/nicore/pull/18","diff_url":"https://github.com/zdogma/nicore/pull/18.diff","patch_url":"https://github.com/zdogma/nicore/pull/18.patch","issue_url":"https://api.github.com/repos/zdogma/nicore/issues/18","number":18,"state":"open","locked":false,"title":"最低限ではあるがnicoの新着ランキングバッチの作成","user":{"login":"t-hrhs","id":4661349,"avatar_url":"https://avatars.githubusercontent.com/u/4661349?v=3","gravatar_id":"","url":"https://api.github.com/users/t-hrhs","html_url":"https://github.com/t-hrhs","followers_url":"https://api.github.com/users/t-hrhs/followers","following_url":"https://api.github.com/users/t-hrhs/following{/other_user}","gists_url":"https://api.github.com/users/t-hrhs/gists{/gist_id}","starred_url":"https://api.github.com/users/t-hrhs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t-hrhs/subscriptions","organizations_url":"https://api.github.com/users/t-hrhs/orgs","repos_url":"https://api.github.com/users/t-hrhs/repos","events_url":"https://api.github.com/users/t-hrhs/events{/privacy}","received_events_url":"https://api.github.com/users/t-hrhs/received_events","type":"User","site_admin":false},"body":"@zdogma \r\n以下の作業を行いました。\r\n\r\n### 実装内容\r\n・taskの生成\r\n・ranking tableの仮マスタ作成\r\n・moviesの指標であるscoreメソッドの新設\r\n・loggerの導入\r\n\r\n### 新着ランキングバッチ詳細\r\n・ranking_idとbatch optionをargsから受け取る\r\n・ranking_idを元に、rankingレコード作成\r\n・実行可能時間かのチェック機構導入(batch optionをつけないことで回避可能)\r\n・moviesから新着のレコードを取得\r\n・score順にソート(sorted_movies)\r\n・sorted_moviesからranking_contentsのインスタンス生成\r\n・transactionを開始し、ranking_contentsをバルクインサート\r\n・rankingが更新されたのでtouchすることでupdated_atを更新\r\n・(後は適宜logを差し込み、update_newly_arrived_by_ranking_id_2015-07-05.logのようなファイルに吐かれるようにした)\r\n\r\n### 実行例\r\n```\r\nrake ranking_updater:update_newly_arrived_by_ranking_id\\[1\\]\r\n```","created_at":"2015-06-28T05:50:59Z","updated_at":"2015-07-05T12:34:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"73b1ad84c71511d4cc30dc29932d33a1549277a1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zdogma/nicore/pulls/18/commits","review_comments_url":"https://api.github.com/repos/zdogma/nicore/pulls/18/comments","review_comment_url":"https://api.github.com/repos/zdogma/nicore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zdogma/nicore/issues/18/comments","statuses_url":"https://api.github.com/repos/zdogma/nicore/statuses/2bea9f79b59ebd593539fee71375f3143d07658b","head":{"label":"zdogma:devel/ranking_batch","ref":"devel/ranking_batch","sha":"2bea9f79b59ebd593539fee71375f3143d07658b","user":{"login":"zdogma","id":1973683,"avatar_url":"https://avatars.githubusercontent.com/u/1973683?v=3","gravatar_id":"","url":"https://api.github.com/users/zdogma","html_url":"https://github.com/zdogma","followers_url":"https://api.github.com/users/zdogma/followers","following_url":"https://api.github.com/users/zdogma/following{/other_user}","gists_url":"https://api.github.com/users/zdogma/gists{/gist_id}","starred_url":"https://api.github.com/users/zdogma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdogma/subscriptions","organizations_url":"https://api.github.com/users/zdogma/orgs","repos_url":"https://api.github.com/users/zdogma/repos","events_url":"https://api.github.com/users/zdogma/events{/privacy}","received_events_url":"https://api.github.com/users/zdogma/received_events","type":"User","site_admin":false},"repo":{"id":38090610,"name":"nicore","full_name":"zdogma/nicore","owner":{"login":"zdogma","id":1973683,"avatar_url":"https://avatars.githubusercontent.com/u/1973683?v=3","gravatar_id":"","url":"https://api.github.com/users/zdogma","html_url":"https://github.com/zdogma","followers_url":"https://api.github.com/users/zdogma/followers","following_url":"https://api.github.com/users/zdogma/following{/other_user}","gists_url":"https://api.github.com/users/zdogma/gists{/gist_id}","starred_url":"https://api.github.com/users/zdogma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdogma/subscriptions","organizations_url":"https://api.github.com/users/zdogma/orgs","repos_url":"https://api.github.com/users/zdogma/repos","events_url":"https://api.github.com/users/zdogma/events{/privacy}","received_events_url":"https://api.github.com/users/zdogma/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zdogma/nicore","description":"ニコ動のボカロ体験をもっとより良くするサービス。","fork":false,"url":"https://api.github.com/repos/zdogma/nicore","forks_url":"https://api.github.com/repos/zdogma/nicore/forks","keys_url":"https://api.github.com/repos/zdogma/nicore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zdogma/nicore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zdogma/nicore/teams","hooks_url":"https://api.github.com/repos/zdogma/nicore/hooks","issue_events_url":"https://api.github.com/repos/zdogma/nicore/issues/events{/number}","events_url":"https://api.github.com/repos/zdogma/nicore/events","assignees_url":"https://api.github.com/repos/zdogma/nicore/assignees{/user}","branches_url":"https://api.github.com/repos/zdogma/nicore/branches{/branch}","tags_url":"https://api.github.com/repos/zdogma/nicore/tags","blobs_url":"https://api.github.com/repos/zdogma/nicore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zdogma/nicore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zdogma/nicore/git/refs{/sha}","trees_url":"https://api.github.com/repos/zdogma/nicore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zdogma/nicore/statuses/{sha}","languages_url":"https://api.github.com/repos/zdogma/nicore/languages","stargazers_url":"https://api.github.com/repos/zdogma/nicore/stargazers","contributors_url":"https://api.github.com/repos/zdogma/nicore/contributors","subscribers_url":"https://api.github.com/repos/zdogma/nicore/subscribers","subscription_url":"https://api.github.com/repos/zdogma/nicore/subscription","commits_url":"https://api.github.com/repos/zdogma/nicore/commits{/sha}","git_commits_url":"https://api.github.com/repos/zdogma/nicore/git/commits{/sha}","comments_url":"https://api.github.com/repos/zdogma/nicore/comments{/number}","issue_comment_url":"https://api.github.com/repos/zdogma/nicore/issues/comments{/number}","contents_url":"https://api.github.com/repos/zdogma/nicore/contents/{+path}","compare_url":"https://api.github.com/repos/zdogma/nicore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zdogma/nicore/merges","archive_url":"https://api.github.com/repos/zdogma/nicore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zdogma/nicore/downloads","issues_url":"https://api.github.com/repos/zdogma/nicore/issues{/number}","pulls_url":"https://api.github.com/repos/zdogma/nicore/pulls{/number}","milestones_url":"https://api.github.com/repos/zdogma/nicore/milestones{/number}","notifications_url":"https://api.github.com/repos/zdogma/nicore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zdogma/nicore/labels{/name}","releases_url":"https://api.github.com/repos/zdogma/nicore/releases{/id}","created_at":"2015-06-26T04:29:28Z","updated_at":"2015-07-05T01:35:07Z","pushed_at":"2015-07-05T12:30:10Z","git_url":"git://github.com/zdogma/nicore.git","ssh_url":"git@github.com:zdogma/nicore.git","clone_url":"https://github.com/zdogma/nicore.git","svn_url":"https://github.com/zdogma/nicore","homepage":"","size":812,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"base":{"label":"zdogma:master","ref":"master","sha":"5ecdbd0a30dd32c60e3aa4c48f4cc83f34519986","user":{"login":"zdogma","id":1973683,"avatar_url":"https://avatars.githubusercontent.com/u/1973683?v=3","gravatar_id":"","url":"https://api.github.com/users/zdogma","html_url":"https://github.com/zdogma","followers_url":"https://api.github.com/users/zdogma/followers","following_url":"https://api.github.com/users/zdogma/following{/other_user}","gists_url":"https://api.github.com/users/zdogma/gists{/gist_id}","starred_url":"https://api.github.com/users/zdogma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdogma/subscriptions","organizations_url":"https://api.github.com/users/zdogma/orgs","repos_url":"https://api.github.com/users/zdogma/repos","events_url":"https://api.github.com/users/zdogma/events{/privacy}","received_events_url":"https://api.github.com/users/zdogma/received_events","type":"User","site_admin":false},"repo":{"id":38090610,"name":"nicore","full_name":"zdogma/nicore","owner":{"login":"zdogma","id":1973683,"avatar_url":"https://avatars.githubusercontent.com/u/1973683?v=3","gravatar_id":"","url":"https://api.github.com/users/zdogma","html_url":"https://github.com/zdogma","followers_url":"https://api.github.com/users/zdogma/followers","following_url":"https://api.github.com/users/zdogma/following{/other_user}","gists_url":"https://api.github.com/users/zdogma/gists{/gist_id}","starred_url":"https://api.github.com/users/zdogma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdogma/subscriptions","organizations_url":"https://api.github.com/users/zdogma/orgs","repos_url":"https://api.github.com/users/zdogma/repos","events_url":"https://api.github.com/users/zdogma/events{/privacy}","received_events_url":"https://api.github.com/users/zdogma/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zdogma/nicore","description":"ニコ動のボカロ体験をもっとより良くするサービス。","fork":false,"url":"https://api.github.com/repos/zdogma/nicore","forks_url":"https://api.github.com/repos/zdogma/nicore/forks","keys_url":"https://api.github.com/repos/zdogma/nicore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zdogma/nicore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zdogma/nicore/teams","hooks_url":"https://api.github.com/repos/zdogma/nicore/hooks","issue_events_url":"https://api.github.com/repos/zdogma/nicore/issues/events{/number}","events_url":"https://api.github.com/repos/zdogma/nicore/events","assignees_url":"https://api.github.com/repos/zdogma/nicore/assignees{/user}","branches_url":"https://api.github.com/repos/zdogma/nicore/branches{/branch}","tags_url":"https://api.github.com/repos/zdogma/nicore/tags","blobs_url":"https://api.github.com/repos/zdogma/nicore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zdogma/nicore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zdogma/nicore/git/refs{/sha}","trees_url":"https://api.github.com/repos/zdogma/nicore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zdogma/nicore/statuses/{sha}","languages_url":"https://api.github.com/repos/zdogma/nicore/languages","stargazers_url":"https://api.github.com/repos/zdogma/nicore/stargazers","contributors_url":"https://api.github.com/repos/zdogma/nicore/contributors","subscribers_url":"https://api.github.com/repos/zdogma/nicore/subscribers","subscription_url":"https://api.github.com/repos/zdogma/nicore/subscription","commits_url":"https://api.github.com/repos/zdogma/nicore/commits{/sha}","git_commits_url":"https://api.github.com/repos/zdogma/nicore/git/commits{/sha}","comments_url":"https://api.github.com/repos/zdogma/nicore/comments{/number}","issue_comment_url":"https://api.github.com/repos/zdogma/nicore/issues/comments{/number}","contents_url":"https://api.github.com/repos/zdogma/nicore/contents/{+path}","compare_url":"https://api.github.com/repos/zdogma/nicore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zdogma/nicore/merges","archive_url":"https://api.github.com/repos/zdogma/nicore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zdogma/nicore/downloads","issues_url":"https://api.github.com/repos/zdogma/nicore/issues{/number}","pulls_url":"https://api.github.com/repos/zdogma/nicore/pulls{/number}","milestones_url":"https://api.github.com/repos/zdogma/nicore/milestones{/number}","notifications_url":"https://api.github.com/repos/zdogma/nicore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zdogma/nicore/labels{/name}","releases_url":"https://api.github.com/repos/zdogma/nicore/releases{/id}","created_at":"2015-06-26T04:29:28Z","updated_at":"2015-07-05T01:35:07Z","pushed_at":"2015-07-05T12:30:10Z","git_url":"git://github.com/zdogma/nicore.git","ssh_url":"git@github.com:zdogma/nicore.git","clone_url":"https://github.com/zdogma/nicore.git","svn_url":"https://github.com/zdogma/nicore","homepage":"","size":812,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zdogma/nicore/pulls/18"},"html":{"href":"https://github.com/zdogma/nicore/pull/18"},"issue":{"href":"https://api.github.com/repos/zdogma/nicore/issues/18"},"comments":{"href":"https://api.github.com/repos/zdogma/nicore/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/zdogma/nicore/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/zdogma/nicore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zdogma/nicore/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/zdogma/nicore/statuses/2bea9f79b59ebd593539fee71375f3143d07658b"}}}}