Clworld

MastodonのToot時処理フロー

May 2nd, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. ※perform_asyncの箇所でSidekiqを経由する
  2.  
  3. /api/v1/statuses/create
  4. ↓
  5. PostStatusService.new.call
  6. ↓
  7. ProcessMentionsService.new.call → (a)
  8. ProcessHashtagsService.new.call → タグとnsfwをパースしてstatusesへ設定
  9. LinkCrawlWorker.perform_async → FetchLinkCardService.new.call → OEmbed, OpenGraph処理
  10. DistributionWorker.perform_async → (b)
  11. Pubsubhubbub::DistributionWorker.perform_async → (c)
  12.  
  13. (a) ProcessMentionsService.new.call
  14. ↓×mention数
  15. リモートのユーザでローカルにアカウント情報がまだ無い場合: FollowRemoteAccountService.new.call
  16. ローカルの場合: NotifyService.new.call → Redis.current.publish, InlineRenderer.render(@notification, @recipient, 'api/v1/notifications/show')
  17. リモートの場合: NotificationWorker.perform_async → SendInteractionService.new.call → OStatus2::Salmon.new.post
  18.  
  19. (b) DistributionWorker.perform_async
  20. ↓
  21. FanOutOnWriteService.new.call
  22. ↓
  23. FeedManager.instance.push ×1 → (d)
  24. FeedInsertWorker.perform_async ×ローカルフォロワー数 → FeedManager.instance.push → (d)
  25. InlineRenderer.render(status, nil, 'api/v1/statuses/show') ×1
  26. Redis.current.publish ×ハッシュタグ数+LTL+FTL
  27.  
  28. (d) FeedManager.instance.push(この時点で×1+ローカルフォロワー数)
  29. ↓
  30. PushUpdateWorker.perform_async
  31. ↓
  32. InlineRenderer.render(status, account, 'api/v1/statuses/show')
  33. Redis.current.publish
  34.  
  35. (c) Pubsubhubbub::DistributionWorker.perform_async
  36. ↓ ×リモートフォロワーが居るサーバ数
  37. Pubsubhubbub::DeliveryWorker.perform_async → HTTP.post → 相手サーバへ
Advertisement
Add Comment
Please, Sign In to add comment