Class: ShowcaseUnpublishedHandler

Inherits:
ApplicationJob show all
Includes:
RailsEventStore::AsyncHandler
Defined in:
app/subscribers/showcase_unpublished_handler.rb

Overview

Async handler for Events::ShowcaseUnpublished.

Purges the CDN edge cache for the showcase's public URLs and archives its
SiteMap entries so accumulated SEO data (keywords, traffic data points,
embeddings) is preserved but the pages are excluded from the live sitemap
and all operational queries.

Instance Method Summary collapse

Instance Method Details

#perform(event) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'app/subscribers/showcase_unpublished_handler.rb', line 14

def perform(event)
  showcase = Showcase.find_by(id: event.data[:showcase_id])
  return unless showcase

  showcase.purge_edge_cache
  showcase.site_maps.update_all(state: 'archived')
rescue StandardError => e
  ErrorReporting.error(e)
  raise
end