{"action":"created","comment":{"url":"https://api.github.com/repos/tootsuite/mastodon/pulls/comments/121398234","pull_request_review_id":43442667,"id":121398234,"diff_hunk":"@@ -57,14 +53,34 @@ def remove_reblogs\n     end\n   end\n \n-  def unpush(type, receiver, status)\n-    if status.reblog? && !redis.zscore(FeedManager.instance.key(type, receiver.id), status.reblog_of_id).nil?\n-      redis.zadd(FeedManager.instance.key(type, receiver.id), status.reblog_of_id, status.reblog_of_id)\n+  def unpush_bulk(type, receiver_ids, status)\n+    return if receiver_ids.empty?\n+\n+    if status.reblog?\n+      scores = redis.pipelined do\n+        receiver_ids.each do |receiver_id|\n+          redis.zscore(FeedManager.instance.key(type, receiver_id), status.reblog_of_id)\n+        end\n+      end\n+\n+      redis.pipelined do\n+        scores.each_with_index do |score, index|\n+          next if score.nil?\n+          redis.zadd(FeedManager.instance.key(type, receiver_ids[index]), status.reblog_of_id, status.reblog_of_id)\n+        end\n+\n+        receiver_ids.each do |receiver_id|\n+          redis.publish(\"timeline:#{receiver_id}\", @payload)","path":"app/services/remove_status_service.rb","position":53,"original_position":53,"commit_id":"63e053099c346f957677471709bffb5f680c3b79","original_commit_id":"63e053099c346f957677471709bffb5f680c3b79","user":{"login":"unarist","id":705555,"avatar_url":"https://avatars1.githubusercontent.com/u/705555?v=3","gravatar_id":"","url":"https://api.github.com/users/unarist","html_url":"https://github.com/unarist","followers_url":"https://api.github.com/users/unarist/followers","following_url":"https://api.github.com/users/unarist/following{/other_user}","gists_url":"https://api.github.com/users/unarist/gists{/gist_id}","starred_url":"https://api.github.com/users/unarist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unarist/subscriptions","organizations_url":"https://api.github.com/users/unarist/orgs","repos_url":"https://api.github.com/users/unarist/repos","events_url":"https://api.github.com/users/unarist/events{/privacy}","received_events_url":"https://api.github.com/users/unarist/received_events","type":"User","site_admin":false},"body":"How about merging `scores.each_with_index do |score, index|` and `receiver_ids.each do |receiver_id|`, like this?\r\n\r\n```rb\r\nscores.each_with_index do |score, index|\r\n  redis.zadd(...) unless score.nil?\r\n  redis.publish(...)\r\nend\r\n```","created_at":"2017-06-12T13:54:23Z","updated_at":"2017-06-12T13:54:23Z","html_url":"https://github.com/tootsuite/mastodon/pull/3714#discussion_r121398234","pull_request_url":"https://api.github.com/repos/tootsuite/mastodon/pulls/3714","_links":{"self":{"href":"https://api.github.com/repos/tootsuite/mastodon/pulls/comments/121398234"},"html":{"href":"https://github.com/tootsuite/mastodon/pull/3714#discussion_r121398234"},"pull_request":{"href":"https://api.github.com/repos/tootsuite/mastodon/pulls/3714"}}},"pull_request":{"url":"https://api.github.com/repos/tootsuite/mastodon/pulls/3714","id":125128336,"html_url":"https://github.com/tootsuite/mastodon/pull/3714","diff_url":"https://github.com/tootsuite/mastodon/pull/3714.diff","patch_url":"https://github.com/tootsuite/mastodon/pull/3714.patch","issue_url":"https://api.github.com/repos/tootsuite/mastodon/issues/3714","number":3714,"state":"open","locked":false,"title":"Pipeline unpush in RemoveStatusService","user":{"login":"akihikodaki","id":17036990,"avatar_url":"https://avatars2.githubusercontent.com/u/17036990?v=3","gravatar_id":"","url":"https://api.github.com/users/akihikodaki","html_url":"https://github.com/akihikodaki","followers_url":"https://api.github.com/users/akihikodaki/followers","following_url":"https://api.github.com/users/akihikodaki/following{/other_user}","gists_url":"https://api.github.com/users/akihikodaki/gists{/gist_id}","starred_url":"https://api.github.com/users/akihikodaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akihikodaki/subscriptions","organizations_url":"https://api.github.com/users/akihikodaki/orgs","repos_url":"https://api.github.com/users/akihikodaki/repos","events_url":"https://api.github.com/users/akihikodaki/events{/privacy}","received_events_url":"https://api.github.com/users/akihikodaki/received_events","type":"User","site_admin":false},"body":"This pull request reintroduces a feature removed by #3672.","created_at":"2017-06-12T12:48:40Z","updated_at":"2017-06-12T13:54:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8cda1a07a783c3fa7fdbeba629760eb0130a022d","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/tootsuite/mastodon/pulls/3714/commits","review_comments_url":"https://api.github.com/repos/tootsuite/mastodon/pulls/3714/comments","review_comment_url":"https://api.github.com/repos/tootsuite/mastodon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tootsuite/mastodon/issues/3714/comments","statuses_url":"https://api.github.com/repos/tootsuite/mastodon/statuses/63e053099c346f957677471709bffb5f680c3b79","head":{"label":"kagucho:unpush","ref":"unpush","sha":"63e053099c346f957677471709bffb5f680c3b79","user":{"login":"kagucho","id":16250089,"avatar_url":"https://avatars1.githubusercontent.com/u/16250089?v=3","gravatar_id":"","url":"https://api.github.com/users/kagucho","html_url":"https://github.com/kagucho","followers_url":"https://api.github.com/users/kagucho/followers","following_url":"https://api.github.com/users/kagucho/following{/other_user}","gists_url":"https://api.github.com/users/kagucho/gists{/gist_id}","starred_url":"https://api.github.com/users/kagucho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kagucho/subscriptions","organizations_url":"https://api.github.com/users/kagucho/orgs","repos_url":"https://api.github.com/users/kagucho/repos","events_url":"https://api.github.com/users/kagucho/events{/privacy}","received_events_url":"https://api.github.com/users/kagucho/received_events","type":"Organization","site_admin":false},"repo":{"id":88395680,"name":"mastodon","full_name":"kagucho/mastodon","owner":{"login":"kagucho","id":16250089,"avatar_url":"https://avatars1.githubusercontent.com/u/16250089?v=3","gravatar_id":"","url":"https://api.github.com/users/kagucho","html_url":"https://github.com/kagucho","followers_url":"https://api.github.com/users/kagucho/followers","following_url":"https://api.github.com/users/kagucho/following{/other_user}","gists_url":"https://api.github.com/users/kagucho/gists{/gist_id}","starred_url":"https://api.github.com/users/kagucho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kagucho/subscriptions","organizations_url":"https://api.github.com/users/kagucho/orgs","repos_url":"https://api.github.com/users/kagucho/repos","events_url":"https://api.github.com/users/kagucho/events{/privacy}","received_events_url":"https://api.github.com/users/kagucho/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kagucho/mastodon","description":"A GNU Social-compatible microblogging server","fork":true,"url":"https://api.github.com/repos/kagucho/mastodon","forks_url":"https://api.github.com/repos/kagucho/mastodon/forks","keys_url":"https://api.github.com/repos/kagucho/mastodon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kagucho/mastodon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kagucho/mastodon/teams","hooks_url":"https://api.github.com/repos/kagucho/mastodon/hooks","issue_events_url":"https://api.github.com/repos/kagucho/mastodon/issues/events{/number}","events_url":"https://api.github.com/repos/kagucho/mastodon/events","assignees_url":"https://api.github.com/repos/kagucho/mastodon/assignees{/user}","branches_url":"https://api.github.com/repos/kagucho/mastodon/branches{/branch}","tags_url":"https://api.github.com/repos/kagucho/mastodon/tags","blobs_url":"https://api.github.com/repos/kagucho/mastodon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kagucho/mastodon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kagucho/mastodon/git/refs{/sha}","trees_url":"https://api.github.com/repos/kagucho/mastodon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kagucho/mastodon/statuses/{sha}","languages_url":"https://api.github.com/repos/kagucho/mastodon/languages","stargazers_url":"https://api.github.com/repos/kagucho/mastodon/stargazers","contributors_url":"https://api.github.com/repos/kagucho/mastodon/contributors","subscribers_url":"https://api.github.com/repos/kagucho/mastodon/subscribers","subscription_url":"https://api.github.com/repos/kagucho/mastodon/subscription","commits_url":"https://api.github.com/repos/kagucho/mastodon/commits{/sha}","git_commits_url":"https://api.github.com/repos/kagucho/mastodon/git/commits{/sha}","comments_url":"https://api.github.com/repos/kagucho/mastodon/comments{/number}","issue_comment_url":"https://api.github.com/repos/kagucho/mastodon/issues/comments{/number}","contents_url":"https://api.github.com/repos/kagucho/mastodon/contents/{+path}","compare_url":"https://api.github.com/repos/kagucho/mastodon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kagucho/mastodon/merges","archive_url":"https://api.github.com/repos/kagucho/mastodon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kagucho/mastodon/downloads","issues_url":"https://api.github.com/repos/kagucho/mastodon/issues{/number}","pulls_url":"https://api.github.com/repos/kagucho/mastodon/pulls{/number}","milestones_url":"https://api.github.com/repos/kagucho/mastodon/milestones{/number}","notifications_url":"https://api.github.com/repos/kagucho/mastodon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kagucho/mastodon/labels{/name}","releases_url":"https://api.github.com/repos/kagucho/mastodon/releases{/id}","deployments_url":"https://api.github.com/repos/kagucho/mastodon/deployments","created_at":"2017-04-16T06:30:51Z","updated_at":"2017-05-13T04:56:23Z","pushed_at":"2017-06-12T13:50:14Z","git_url":"git://github.com/kagucho/mastodon.git","ssh_url":"git@github.com:kagucho/mastodon.git","clone_url":"https://github.com/kagucho/mastodon.git","svn_url":"https://github.com/kagucho/mastodon","homepage":"https://mastodon.social","size":43553,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"tootsuite:master","ref":"master","sha":"0d23c81662cfa798da910a8abe00ef391b1e2aef","user":{"login":"tootsuite","id":24979032,"avatar_url":"https://avatars0.githubusercontent.com/u/24979032?v=3","gravatar_id":"","url":"https://api.github.com/users/tootsuite","html_url":"https://github.com/tootsuite","followers_url":"https://api.github.com/users/tootsuite/followers","following_url":"https://api.github.com/users/tootsuite/following{/other_user}","gists_url":"https://api.github.com/users/tootsuite/gists{/gist_id}","starred_url":"https://api.github.com/users/tootsuite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tootsuite/subscriptions","organizations_url":"https://api.github.com/users/tootsuite/orgs","repos_url":"https://api.github.com/users/tootsuite/repos","events_url":"https://api.github.com/users/tootsuite/events{/privacy}","received_events_url":"https://api.github.com/users/tootsuite/received_events","type":"Organization","site_admin":false},"repo":{"id":52281283,"name":"mastodon","full_name":"tootsuite/mastodon","owner":{"login":"tootsuite","id":24979032,"avatar_url":"https://avatars0.githubusercontent.com/u/24979032?v=3","gravatar_id":"","url":"https://api.github.com/users/tootsuite","html_url":"https://github.com/tootsuite","followers_url":"https://api.github.com/users/tootsuite/followers","following_url":"https://api.github.com/users/tootsuite/following{/other_user}","gists_url":"https://api.github.com/users/tootsuite/gists{/gist_id}","starred_url":"https://api.github.com/users/tootsuite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tootsuite/subscriptions","organizations_url":"https://api.github.com/users/tootsuite/orgs","repos_url":"https://api.github.com/users/tootsuite/repos","events_url":"https://api.github.com/users/tootsuite/events{/privacy}","received_events_url":"https://api.github.com/users/tootsuite/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tootsuite/mastodon","description":"A GNU Social-compatible microblogging server","fork":false,"url":"https://api.github.com/repos/tootsuite/mastodon","forks_url":"https://api.github.com/repos/tootsuite/mastodon/forks","keys_url":"https://api.github.com/repos/tootsuite/mastodon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tootsuite/mastodon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tootsuite/mastodon/teams","hooks_url":"https://api.github.com/repos/tootsuite/mastodon/hooks","issue_events_url":"https://api.github.com/repos/tootsuite/mastodon/issues/events{/number}","events_url":"https://api.github.com/repos/tootsuite/mastodon/events","assignees_url":"https://api.github.com/repos/tootsuite/mastodon/assignees{/user}","branches_url":"https://api.github.com/repos/tootsuite/mastodon/branches{/branch}","tags_url":"https://api.github.com/repos/tootsuite/mastodon/tags","blobs_url":"https://api.github.com/repos/tootsuite/mastodon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tootsuite/mastodon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tootsuite/mastodon/git/refs{/sha}","trees_url":"https://api.github.com/repos/tootsuite/mastodon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tootsuite/mastodon/statuses/{sha}","languages_url":"https://api.github.com/repos/tootsuite/mastodon/languages","stargazers_url":"https://api.github.com/repos/tootsuite/mastodon/stargazers","contributors_url":"https://api.github.com/repos/tootsuite/mastodon/contributors","subscribers_url":"https://api.github.com/repos/tootsuite/mastodon/subscribers","subscription_url":"https://api.github.com/repos/tootsuite/mastodon/subscription","commits_url":"https://api.github.com/repos/tootsuite/mastodon/commits{/sha}","git_commits_url":"https://api.github.com/repos/tootsuite/mastodon/git/commits{/sha}","comments_url":"https://api.github.com/repos/tootsuite/mastodon/comments{/number}","issue_comment_url":"https://api.github.com/repos/tootsuite/mastodon/issues/comments{/number}","contents_url":"https://api.github.com/repos/tootsuite/mastodon/contents/{+path}","compare_url":"https://api.github.com/repos/tootsuite/mastodon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tootsuite/mastodon/merges","archive_url":"https://api.github.com/repos/tootsuite/mastodon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tootsuite/mastodon/downloads","issues_url":"https://api.github.com/repos/tootsuite/mastodon/issues{/number}","pulls_url":"https://api.github.com/repos/tootsuite/mastodon/pulls{/number}","milestones_url":"https://api.github.com/repos/tootsuite/mastodon/milestones{/number}","notifications_url":"https://api.github.com/repos/tootsuite/mastodon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tootsuite/mastodon/labels{/name}","releases_url":"https://api.github.com/repos/tootsuite/mastodon/releases{/id}","deployments_url":"https://api.github.com/repos/tootsuite/mastodon/deployments","created_at":"2016-02-22T15:01:25Z","updated_at":"2017-06-12T11:55:25Z","pushed_at":"2017-06-12T13:42:57Z","git_url":"git://github.com/tootsuite/mastodon.git","ssh_url":"git@github.com:tootsuite/mastodon.git","clone_url":"https://github.com/tootsuite/mastodon.git","svn_url":"https://github.com/tootsuite/mastodon","homepage":"https://mastodon.social","size":39221,"stargazers_count":9345,"watchers_count":9345,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1786,"mirror_url":null,"open_issues_count":728,"forks":1786,"open_issues":728,"watchers":9345,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tootsuite/mastodon/pulls/3714"},"html":{"href":"https://github.com/tootsuite/mastodon/pull/3714"},"issue":{"href":"https://api.github.com/repos/tootsuite/mastodon/issues/3714"},"comments":{"href":"https://api.github.com/repos/tootsuite/mastodon/issues/3714/comments"},"review_comments":{"href":"https://api.github.com/repos/tootsuite/mastodon/pulls/3714/comments"},"review_comment":{"href":"https://api.github.com/repos/tootsuite/mastodon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tootsuite/mastodon/pulls/3714/commits"},"statuses":{"href":"https://api.github.com/repos/tootsuite/mastodon/statuses/63e053099c346f957677471709bffb5f680c3b79"}}}}
{"actor":{"display_login":"unarist"}}