Class: ArticlePublishedHandler
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- ArticlePublishedHandler
- Includes:
- RailsEventStore::AsyncHandler
- Defined in:
- app/subscribers/article_published_handler.rb
Overview
Async handler for Events::ArticlePublished.
Purges the CDN edge cache for the article's pages and all indirectly
associated product lines and items, and populates the editorial link
graph for all article types.
Runs asynchronously so the CRM state transition response is not delayed.
Instance Method Summary collapse
Instance Method Details
#perform(event) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/subscribers/article_published_handler.rb', line 15 def perform(event) article = Article.find_by(id: event.data[:article_id]) return unless article article.purge_edge_cache(include_indirect_associations: true) upsert_link_graph(article) rescue StandardError => e ErrorReporting.error(e) raise end |