mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Fix obsolete cache key in status cache invalidation logic (#26934)
This commit is contained in:
parent
5d93e98da4
commit
e4f5114aaf
@ -407,6 +407,6 @@ class MediaAttachment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def reset_parent_cache
|
def reset_parent_cache
|
||||||
Rails.cache.delete("statuses/#{status_id}") if status_id.present?
|
Rails.cache.delete("v3:statuses/#{status_id}") if status_id.present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -108,7 +108,7 @@ class Poll < ApplicationRecord
|
|||||||
def reset_parent_cache
|
def reset_parent_cache
|
||||||
return if status_id.nil?
|
return if status_id.nil?
|
||||||
|
|
||||||
Rails.cache.delete("statuses/#{status_id}")
|
Rails.cache.delete("v3:statuses/#{status_id}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def last_fetched_before_expiration?
|
def last_fetched_before_expiration?
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
class StatusStat < ApplicationRecord
|
class StatusStat < ApplicationRecord
|
||||||
belongs_to :status, inverse_of: :status_stat
|
belongs_to :status, inverse_of: :status_stat
|
||||||
|
|
||||||
after_commit :reset_parent_cache
|
|
||||||
|
|
||||||
def replies_count
|
def replies_count
|
||||||
[attributes['replies_count'], 0].max
|
[attributes['replies_count'], 0].max
|
||||||
end
|
end
|
||||||
@ -29,10 +27,4 @@ class StatusStat < ApplicationRecord
|
|||||||
def favourites_count
|
def favourites_count
|
||||||
[attributes['favourites_count'], 0].max
|
[attributes['favourites_count'], 0].max
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def reset_parent_cache
|
|
||||||
Rails.cache.delete("statuses/#{status_id}")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user