Attempt fixing deadlocks by moving account stats update outside transaction (#9437)
* Use `update_column` instead of `update_attribute` in callback `update_attribute` would normally cause callbacks to be called. Called from a callback, it seems to stop further callbacks from executing. `update_column` does the same work, but without calling callbacks or preventing other callbacks from executing. * Fix deadlocks by moving account stats update outside transactionlolsob-rspec
parent
2a9843a021
commit
88faa4ff2d
|
@ -236,8 +236,8 @@ class Status < ApplicationRecord
|
||||||
update_status_stat!(key => [public_send(key) - 1, 0].max)
|
update_status_stat!(key => [public_send(key) - 1, 0].max)
|
||||||
end
|
end
|
||||||
|
|
||||||
after_create :increment_counter_caches
|
after_create_commit :increment_counter_caches
|
||||||
after_destroy :decrement_counter_caches
|
after_destroy_commit :decrement_counter_caches
|
||||||
|
|
||||||
after_create_commit :store_uri, if: :local?
|
after_create_commit :store_uri, if: :local?
|
||||||
after_create_commit :update_statistics, if: :local?
|
after_create_commit :update_statistics, if: :local?
|
||||||
|
@ -426,7 +426,7 @@ class Status < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def store_uri
|
def store_uri
|
||||||
update_attribute(:uri, ActivityPub::TagManager.instance.uri_for(self)) if uri.nil?
|
update_column(:uri, ActivityPub::TagManager.instance.uri_for(self)) if uri.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepare_contents
|
def prepare_contents
|
||||||
|
|
Loading…
Reference in New Issue