* Bump rubocop from 1.17.0 to 1.18.0 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.17.0 to 1.18.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.17.0...v1.18.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * yarn install * Fix violations * Restore the default aligned setting * Trigger Travis CI * Escape HTML Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: rhymes <github@rhymes.dev>
24 lines
701 B
Ruby
24 lines
701 B
Ruby
module Reactions
|
|
class BustReactableCacheWorker
|
|
include Sidekiq::Worker
|
|
|
|
sidekiq_options queue: :high_priority, retry: 10
|
|
|
|
def perform(reaction_id)
|
|
reaction = Reaction.find_by(id: reaction_id)
|
|
return unless reaction&.reactable
|
|
|
|
cache_bust = EdgeCache::Bust.new
|
|
cache_bust.call(reaction.user.path)
|
|
|
|
case reaction.reactable_type
|
|
when "Article"
|
|
cache_bust.call("/reactions?article_id=#{reaction.reactable_id}")
|
|
when "Comment"
|
|
path = "/reactions?commentable_id=#{reaction.reactable.commentable_id}&" \
|
|
"commentable_type=#{reaction.reactable.commentable_type}"
|
|
cache_bust.call(path)
|
|
end
|
|
end
|
|
end
|
|
end
|