0
0
Fork 0
mirror of https://github.com/lunaisnotaboy/mastodon.git synced 2024-12-26 23:26:41 +00:00
Commit graph

5 commits

Author SHA1 Message Date
Claire 526332c545
Fix account deletion sometimes failing because of optimistic locks ()
* Fix account deletion sometimes failing because of optimistic locks

In some rare occasions[1], deleting accounts would fail with a
`StaleObjectError` exception.

Indeed, account deletion manually sets the `AccountStat` values without
handling cases where the optimistic locking on `AccountStat` would fail.

To my knowledge, with the rewrite of account counters in , the
`DeleteAccountService` is now the only place that changes the counters in
a way that is not atomic.

Since in this specific case, we do not care about the previous values of the
account counters, it appears we don't need locking at all for this table
anymore.

[1]: https://discourse.joinmastodon.org/t/account-cant-be-deleted/3602

* Bump MAX_SUPPORTED_VERSION in maintenance script
2021-06-02 17:41:25 +02:00
Claire 741d0952b1
Improve account counters handling ()
* Improve account counters handling

* Use ActiveRecord::Base::sanitize_sql to pass values instead of interpolating them

Keep using string interpolation for `key` as it is safe and using
“ActiveRecord::Base::sanitize_sql_hash_for_assignment” would require stitching
bits of SQL in a way that is not more easily checked for safety.

* Add migration hook to catch PostgreSQL versions earlier than 9.5
2021-03-19 13:14:57 +01:00
Eugen Rochko 96702e7f67
Add tootctl cache recount command () 2019-08-18 14:55:03 +02:00
Eugen Rochko 73be8f38c1
Add profile directory ()
Fix 
2018-12-06 17:36:11 +01:00
Eugen Rochko d6b9a62e0a
Extract counters from accounts table to account_stats table () 2018-11-19 00:43:52 +01:00