Previous fix had a bug - in `:after_commit` `self.changes` is empty, and the changes are in `self.previous_changes`. Also this only needs to run on update. This commit adds tests to make sure cached_counters continue to work correctly in the future.
Related issues
Bug #12241: Counter cache update didn't pick up changes from after_commit callback
Fixes #12241 - Correct counter_cache deadlock fix
Previous fix had a bug - in `:after_commit` `self.changes` is empty, and the
changes are in `self.previous_changes`. Also this only needs to run on
update.
This commit adds tests to make sure cached_counters continue to work
correctly in the future.