AnswererWatcherをnewspaperからActiveSupport::Notificationsに移行#8835
AnswererWatcherをnewspaperからActiveSupport::Notificationsに移行#8835
Conversation
|
""" Walkthrough
Changes
Sequence Diagram(s)sequenceDiagram
participant Controller as AnswersController
participant ASNotifications as ActiveSupport::Notifications
participant Watcher as AnswererWatcher
Controller->>ASNotifications: instrument('answer.create', answer: @answer)
ASNotifications-->>Watcher: call(_name, _started, _finished, _unique_id, payload)
Watcher->>Watcher: answer監視・Watch作成
Possibly related issues
Poem
""" Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 RuboCop (1.75.5)config/initializers/active_support_notifications.rbrubocop-minitest extension supports plugin, specify app/controllers/api/answers_controller.rbrubocop-minitest extension supports plugin, specify 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
- config/initializers/active_support_notifications.rbを追加 - AnswererWatcherクラスをActiveSupport::Notificationsのインターフェースに対応 - AnswersControllerでイベント発火をActiveSupport::Notifications.instrumentに変更 - newspaper.rbからAnswererWatcherの登録を削除
d466746 to
5dca2c8
Compare
- AnswersControllerでActiveSupport::NotificationsとNewspaperの両方でイベント発火 - AnswererWatcherからデバッグログを削除 - active_support_notifications.rbでRails.application.reloader.to_prepareを使用
Summary
変更内容
config/initializers/active_support_notifications.rbを新規作成し、ActiveSupport::Notificationsでのサブスクライブを設定AnswererWatcher#callメソッドをActiveSupport::Notificationsの標準インターフェースに対応(引数を5つに変更)API::AnswersControllerでNewspaper.publish(:answer_create, ...)をActiveSupport::Notifications.instrument('answer.create', ...)に変更config/initializers/newspaper.rbからAnswererWatcherの登録を削除Test plan
Summary by CodeRabbit