Created
September 26, 2017 14:39
-
-
Save abcang/1db9d5307cd25dee63c655c4b8b041c9 to your computer and use it in GitHub Desktop.
PawooでDMを送ったときのInboxesControllerの様子
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1 | # frozen_string_literal: true | |
| 2 | | |
| 3 | class ActivityPub::InboxesController < Api::BaseController | |
| 4 | include SignatureVerification | |
| 5 | | |
| 6 | before_action :set_account | |
| 7 | | |
| 8 | def create | |
18 (15.3%) | 9 | if signed_request_account | |
1 (0.8%) | 10 | upgrade_account | |
9 (7.6%) | 11 | process_payload | |
2 (1.7%) | 12 | head 201 | |
| 13 | else | |
| 14 | head 202 | |
| 15 | end | |
| 16 | end | |
| 17 | | |
| 18 | private | |
| 19 | | |
| 20 | def set_account | |
31 (26.3%) | 21 | @account = Account.find_local!(params[:account_username]) if params[:account_username] | |
| 22 | end | |
| 23 | | |
| 24 | def body | |
| 25 | @body ||= request.body.read | |
| 26 | end | |
| 27 | | |
| 28 | def upgrade_account | |
1 (0.8%) | 29 | if signed_request_account.ostatus? | |
| 30 | signed_request_account.update(last_webfingered_at: nil) | |
| 31 | ResolveRemoteAccountWorker.perform_async(signed_request_account.acct) | |
| 32 | end | |
| 33 | | |
| 34 | Pubsubhubbub::UnsubscribeWorker.perform_async(signed_request_account.id) if signed_request_account.subscribed? | |
| 35 | end | |
| 36 | | |
| 37 | def process_payload | |
9 (7.6%) | 38 | ActivityPub::ProcessingWorker.perform_async(signed_request_account.id, body.force_encoding('UTF-8')) | |
| 39 | end | |
| 40 | end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
intervalが100なので、左側の数字は1あたりだいたい0.1ミリ秒です
Account.find_local!
が3ミリ秒かかってるのはだいたい合ってそうActivityPub::InboxesControllerが遅いとは思えない