You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From what I can tell with git's blame/log, this was added in 1af146f and then modified as a fix for DatabaseCleaner/database_cleaner#200. These seem to indicate that this empty transaction only needs to be run once, perhaps at the start of the suite, or perhaps with a flag indicating it's been run once and doesn't need to run again.
It's clearly not the end of the world, but I am currently on a spec optimisation push and this extra BEGIN/COMMIT per test is having a not-insignificant (but admittedly not major) impact on test time: My metrics indicate it's adding about 15 seconds of time to a suite with 6200ish tests.
Happy to help and create a pull request if there's consensus that I haven't misunderstood the purpose of that statement!
The text was updated successfully, but these errors were encountered:
I am using a standard
:transaction
DatabaseCleaner block with rspec:When trying to profile the queries in the test suite, I noticed there was a large number of COMMIT statements: one for each test, and equivalent to the ROLLBACK query count. After digging, it seems the strategy runs a blank transaction in the DatabaseCleaner#begin block: https://github.com/DatabaseCleaner/database_cleaner/blob/cda982c9b4a8f3f116ed7e39766eb1447e0197aa/lib/database_cleaner/active_record/transaction.rb#L12
From what I can tell with git's blame/log, this was added in 1af146f and then modified as a fix for DatabaseCleaner/database_cleaner#200. These seem to indicate that this empty transaction only needs to be run once, perhaps at the start of the suite, or perhaps with a flag indicating it's been run once and doesn't need to run again.
It's clearly not the end of the world, but I am currently on a spec optimisation push and this extra BEGIN/COMMIT per test is having a not-insignificant (but admittedly not major) impact on test time: My metrics indicate it's adding about 15 seconds of time to a suite with 6200ish tests.
Happy to help and create a pull request if there's consensus that I haven't misunderstood the purpose of that statement!
The text was updated successfully, but these errors were encountered: