Comments (10)
thanks a lot for your quick responses, I'm closing the ticket since both problems originated from my side
from isolator.
I believe the first problem is the mailer adapter doesn't recognize
What is delay
? Sidekiq delay extensions or delayed_job? If you use delayed_job then it shouldn't raise, since delaying the execution means storing the record in the DB, and thus it only "survives" if the transaction commits.
my expectation is error shouldn't be thrown because send_second_email it's done after the transaction in after_commit
Correct. The bug is probably with the transaction detection in test env. Have you tried to run the create code in dev mode (i.e., in rails c
)? Do you use transactional_tests
or DatabaseCleaner?
from isolator.
What is
delay
?
Have you tried to run the create code in dev mode (i.e., in rails c)?
Yes, things are working as expected in dev (aside from delay
problem above)
Do you use transactional_tests or DatabaseCleaner?
DatabaseCleaner. I dug a little deeper and found that before the actual test portion, Isolator.transactions_threshold
is 2 and Thread.current.fetch(:isolator_transactions, 0)
is also 2. So it makes sense that send_second_email
triggers an error. I believe this is a problem on my side, there's one more layer of transaction wrapped in my test setup somewhere.
from isolator.
Isolator.transactions_threshold is 2
Could you share your DatabaseCleaner configuration?
Which Rails version do you use, btw?
It's sidekiq delay extensions
We probably need some tests for this case first)
from isolator.
Could you share your DatabaseCleaner configuration?
RSpec.configure do |config|
config.around do |example|
# this is for ar_after_transaction: https://github.com/grosser/ar_after_transaction#transactional-fixtures---normally_open_transactions
ActiveRecord::Base.normally_open_transactions = 0
example.run
DatabaseCleaner.clean_with(:truncation, pre_count: true)
end
end
Which Rails version do you use, btw?
5.1.7 (ruby 2.6.5)
from isolator.
Could you try disabling ar_after_transaction
? They do some AR monkey-patching, probably, incompatible with Isolator.
P.S. Btw, there is a better alternative to this gem which uses AR API with zero monkey-patching: https://github.com/Envek/after_commit_everywhere.
from isolator.
Could you try disabling ar_after_transaction?
Disabling it didn't help. But I workaround it by adding 1 more to Isolator.transactions_threshold
in test environment. It's not a permanent solution but at least it allows me to run tests and identify the true violations.
Any word on supporting sidekiq delay extensions (the first problem)?
from isolator.
Any word on supporting sidekiq delay extensions (the first problem)?
Couldn't reproduce (see the test).
Could you please try to write a single file reproduction script (e.g., using a Rails bug report template)?
from isolator.
Which version of DatabaseCleaner do you use? Is it 1.8.0+ (it has a lot of internal changes)?
from isolator.
I figured out the mystery with sidekiq delay extension problem. We have an override that defers delay
call to after transaction, so it makes sense that isolator doesn't throw error when enqueuing jobs with .delay
from isolator.
Related Issues (20)
- KeyError: key not found: isolator_threshold HOT 3
- NoMethodError when building an exception for Faraday request HOT 3
- Idea: Add an RSpec matcher HOT 2
- Active Storage - Analyze Job - Always fails because of after_create_commit callback HOT 3
- Ignore http requests in models that save files to AWS using carrier_waive HOT 2
- Using isolator with multiple database connections HOT 4
- Being able to allow/ignore inside a specific transaction HOT 3
- Isolator behaves differently between rails 6.1.3.2 and 6.1.4 HOT 3
- Failure when saving attachment with action_text/active storage and AWS HOT 1
- Any reason to not run in production? HOT 1
- Crashes when used with `disable_ddl_transaction!` & `commit_db_transaction` HOT 2
- Add .isolator_ignore support HOT 3
- Error raised when query has invalid encoding HOT 3
- Stack level too deep HOT 1
- Subtransactions tracking/preventions HOT 2
- How to handle rescue of StandardError? HOT 3
- Sidekiq isolator doesn't work if "sidekiq/testing" is required only AFTER "isolator" HOT 2
- Sidekiq isolator doesn't work if "sidekiq/testing" is required only AFTER "isolator" HOT 2
- Mailer is not present in Isolator.adapters after initialize HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from isolator.