-
Task
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
-
False
-
-
False
-
Not Started
-
Not Started
-
Not Started
-
Not Started
-
Not Started
-
Not Started
-
-
In the upgrade to Rails 7.1, there was something that I missed. Probably because it's not in the generic release notes for [7.1\(https://guides.rubyonrails.org/7_1_release_notes.html].
The change is that now order of the after_commit callbacks is as it is defined in the code, while prior to 7.1 the order was reversed. See https://guides.rubyonrails.org/active_record_callbacks.html#transactional-callback-ordering
This specifically affected the callbacks on usage limits creation, where two callbacks are defined (and note also the comment that proves the privious statement):
So, after Rails upgrade, the order got reversed, and currently first update is performed, and then delete, so effectively any change in the usage limits deletes any limits in backend for that metric (thus making system and backend out of sync).
This PR https://github.com/3scale/porta/pull/4151 temporarily restores the previous behavior, by setting
config.active_record.run_after_transaction_callbacks_in_order_defined = false
This issue is to remove this setting, and fix the order of all callbacks throughout the code base.
Also, as part of this PR, make sure that the usage limits setting is covered by tests.