aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/referential_metadata.rb
diff options
context:
space:
mode:
authorTeddy Wing2018-04-06 16:37:33 +0200
committerAlban Peignier2018-04-16 09:09:20 +0200
commitb05676bdda09c10a7130e0f86527a75e6535dad8 (patch)
tree928784b2203a5838cae56ddd7f10cd0422efcfc2 /app/models/referential_metadata.rb
parent2346cdedc9f75cc3af36f856d2b732209af8caab (diff)
downloadchouette-core-b05676bdda09c10a7130e0f86527a75e6535dad8.tar.bz2
Route: Change `#calculate_costs!` to `after_commit` callback
Use an `after_commit` instead of an `after_save`. The `after_save` could cause intermittent problems due to Sidekiq starting before the record/transaction actually gets committed to the database. In those cases, the record wouldn't be found and cause an error. With an `after_commit` callback, the record is sure to be committed before Sidekiq takes over. Additionally, limit the callback to `:create` and `:update` because otherwise it will be active on `:destroy` by default also. This work isn't relevant on destroy, so don't do it then. Update the tests: * Update labels * Use `build` instead of `create` because we're saving the record at the end anyway so we don't need an object that starts out persisted * Use `truncation: true` for these tests because otherwise the `commit` callback doesn't get called due to transactional teardown Refs #6407
Diffstat (limited to 'app/models/referential_metadata.rb')
0 files changed, 0 insertions, 0 deletions