Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after_commit deprecation - what is actually deprecated? #761

Closed
ryanuber opened this issue Nov 9, 2021 · 5 comments
Closed

after_commit deprecation - what is actually deprecated? #761

ryanuber opened this issue Nov 9, 2021 · 5 comments

Comments

@ryanuber
Copy link

ryanuber commented Nov 9, 2021

Hi! First and foremost, thank you for AASM. We've used it extensively with great success.

Recently we upgraded an older app to version 5.2.0 of AASM, from 4.x. In doing so, we began noticing the deprecation notice for :after_commit, and the suggestion for using the after_commit_everywhere gem. For the app in question, however, we are very well aware of the potential race conditions and other quirks using :after_commit, and over time we've built safeguards ourselves that prevent us from performing dangerous actions in nested transactions and other such cases.

My question is, what exactly is deprecated? Is use of after_commit in general deprecated? Can we expect a breaking change in the future? Or is it simply use of after_commit without after_commit_everywhere? We're trying to gauge whether we should proactively start refactoring, even though after_commit is working well for us without after_commit_everywhere.

Thanks for any insight you can offer!

@MuhammadRazaAslam
Copy link

MuhammadRazaAslam commented Dec 24, 2021

@anilmaurya @Envek @alto @ivantsepp Can anyone of you explain the reason for adding the after_commit_everywhere gem and what will happen if we will not add it in our gem file?

@Envek
Copy link
Contributor

Envek commented Dec 27, 2021

Hi @ryanuber, @MuhammadRazaAslam.

My question is, what exactly is deprecated?

As far as I understand, use of after_commit without after_commit_everywhere gem is deprecated.

As per README § Transaction support:

Please note that :after_commit AASM callbacks behaves around custom implementation of transaction pattern rather than a real-life DB transaction. This fact still causes the race conditions and redundant callback calls within nested transaction. In order to fix that it's highly recommended to add gem 'after_commit_everywhere', '~> 1.0' to your Gemfile.

See #666 and #668 for more context.

@MuhammadRazaAslam
Copy link

@Envek Thanks for the explanation.

@anilmaurya
Copy link
Member

Thank you @Envek

@ryanuber I am closing this issue, please reopen if you need more explanation

@route
Copy link

route commented Sep 2, 2023

Still not clear why we need this gem since AR has it's own after_commit which I thought is gonna be used.
Anyways even if you add after_commit_everywhere gem what is deprecated? You still will be using :after_commit nevertheless, so what exactly is deprecated? The message is confusing because nothing is deprecated and it's just a warning to add an extra gem that this gem relies on, in other words a dependency?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants