Add tootctl cache recount command (#11597)

This commit is contained in:
Eugen Rochko 2019-08-18 14:55:03 +02:00 committed by GitHub
parent 8a555534ec
commit 96702e7f67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 3 deletions

View file

@ -388,13 +388,16 @@ class Status < ApplicationRecord
end
end
def status_stat
super || build_status_stat
end
private
def update_status_stat!(attrs)
return if marked_for_destruction? || destroyed?
record = status_stat || build_status_stat
record.update(attrs)
status_stat.update(attrs)
end
def store_uri