-
Notifications
You must be signed in to change notification settings - Fork 638
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
Fix after commit within nested transaction vol2 #668
Fix after commit within nested transaction vol2 #668
Conversation
bab3796
to
84171e2
Compare
Codecov Report
@@ Coverage Diff @@
## master #668 +/- ##
==========================================
- Coverage 95.14% 95.01% -0.14%
==========================================
Files 35 35
Lines 1236 1243 +7
==========================================
+ Hits 1176 1181 +5
- Misses 60 62 +2
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #668 +/- ##
==========================================
- Coverage 95.14% 95.01% -0.14%
==========================================
Files 35 35
Lines 1236 1243 +7
==========================================
+ Hits 1176 1181 +5
- Misses 60 62 +2
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #668 +/- ##
==========================================
- Coverage 95.14% 95.09% -0.06%
==========================================
Files 35 35
Lines 1236 1243 +7
==========================================
+ Hits 1176 1182 +6
- Misses 60 61 +1
Continue to review full report at Codecov.
|
Apologies for intruding, but can I suggest using after_commit_everywhere from the good folks at Evil Martian instead?
Both provides the same functionality. @stokarenko what do you think? |
Historically I came to Will play with |
@louim tried |
@anilmaurya could you review this PR please? ) |
84171e2
to
55a01ec
Compare
@stokarenko I see. If I understand the code correctly, ActiveRecord > 5 should only be required for the But I'll leave that to your discretion and / or the maintainer call. Thank you for trying |
Codecov Report
@@ Coverage Diff @@
## master #668 +/- ##
==========================================
- Coverage 95.14% 95.09% -0.06%
==========================================
Files 35 35
Lines 1236 1243 +7
==========================================
+ Hits 1176 1182 +6
- Misses 60 61 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #668 +/- ##
==========================================
- Coverage 95.14% 95.09% -0.06%
==========================================
Files 35 35
Lines 1236 1243 +7
==========================================
+ Hits 1176 1182 +6
- Misses 60 61 +1
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #668 +/- ##
==========================================
- Coverage 95.14% 95.09% -0.06%
==========================================
Files 35 35
Lines 1236 1243 +7
==========================================
+ Hits 1176 1182 +6
- Misses 60 61 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #668 +/- ##
==========================================
- Coverage 95.14% 95.09% -0.06%
==========================================
Files 35 35
Lines 1236 1243 +7
==========================================
+ Hits 1176 1182 +6
- Misses 60 61 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #668 +/- ##
==========================================
- Coverage 95.14% 95.09% -0.06%
==========================================
Files 35 35
Lines 1236 1243 +7
==========================================
+ Hits 1176 1182 +6
- Misses 60 61 +1
Continue to review full report at Codecov.
|
Hi @stokarenko @louim I think it's time to remove support for I will release a major version |
Roger! ) I'll prepare the changes using |
Pushed one more commit using |
Just thinking - perhaps we need to check the version of |
@anilmaurya could you revisit please? ) |
Thanks for reminder @stokarenko , I will revisit on coming weekend. |
Hi @stokarenko |
5a33ba7
to
32dc48a
Compare
Code Climate has analyzed commit 32dc48a and detected 0 issues on this pull request. View more on Code Climate. |
@anilmaurya done! ) also added the next constraint, just in case: raise LoadError unless Gem::Version.new(::AfterCommitEverywhere::VERSION) >= Gem::Version.new('0.1.5') |
Merged. Thank you @stokarenko for your contribution. I will do a major release |
@anilmaurya Hey again ) thinking about the bang method requirement for after_commit:
This behavior is frustrating a lot I believe, again the callback is silently skipped sometimes. Perhaps that bang method was required due to synthetic nature of transactions support. But now we support them in right way, and can discard bang-method limitation. For sure that will be a breaking change in fact, but fortunately we are going to a new major release, so - what do you think? ) |
Hi @stokarenko Most of AASM users comes from Rails background. In Rails after_commit is invoked when record is updated. AASM follows same behaviour to avoid confusion. |
right, but the sample from readme shows yet another behavior:
job = Job.where(state: 'sleeping').first!
job.run
job.save! #notify_about_running_job is not run
The record has been updated, but AASM's after_commit callback was silently skipped.. Please note that with a help of |
Hi @stokarenko
Ideally after_commit should be fired in following cases:
and it won't fire on If this is possible using |
@anilmaurya Roger, will try to prepare PR ) |
Hi @stokarenko any news about this ? We are stuck with a current scenario:
The issue still remain, even specifying the option, we do have child transaction created so the email is sent before the entire collection got changed. |
@aovertus This PR should fix your problem. It is in master already but not released as a new AASM version though. Try to point your gemfile to the edge master upstream for the while ) |
@aovertus on the way try to remove and for sure you need to add |
working, thanks a lot @stokarenko |
It brings #666 back, but without explicit
after_commit_action
dependency.