-
Notifications
You must be signed in to change notification settings - Fork 79
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
The tracked callback should be implemented using after_commit instead of after_create/after_update #99
Comments
Totally agree, as after_commit callback ensures that transaction is finished and object persist in database. Im using override in initializer to avoid this problem. |
Can you create a pull request for this? |
I opened #100, but couldn't run the test because of dependency issue. Can you check that out? |
Thank you for your PR. As you mentioned, we have to pass the tests. It seems to be more than just dependency issue. |
Current test result is here: https://travis-ci.org/simukappu/activity_notification/builds/520095237 |
@simukappu I have modified the pull requests. And somehow, a few tests only in Rails 5.1 are failed. I wonder if it's Rails specific error? |
Actually there was issue with after_commit for 5.1.x. It was fixed on 5.1-stable |
@irondnb Thank you for the information. I couldn't get my head around this. Is there anything we can do to solve this problem? |
@Looooong I avoided this Rails issue with above commit and will merge your PR. Thank you for your contribution! |
Just released as v1.7.1. Thanks! |
Whenever
notify_later
orsend_later
is enabled in thetracked
option on a notifiable, a job is enqueued to be processed. However, in some instance, the job back-end may process the job before the notifiable is persisted in the database. This results in exception on the job back-end.I suggest that this code:
activity_notification/lib/activity_notification/roles/acts_as_notifiable.rb
Lines 280 to 289 in 07f13c1
should be replaced with:
The text was updated successfully, but these errors were encountered: