Add "Nested Transactions" section#355
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
|
Thank you for sharing this article. This article seems to be referring to performance issues caused by nested transactions in PostgreSQL. Please note that this PR is not about whether you should use nested transactions, but only that if you do, you should not use |
pirj
left a comment
There was a problem hiding this comment.
This makes total sense.
I apologize for an unrelated reference above.
Here are some related references:
- a PR with a cop corresponding to this guideline rubocop/rubocop-rails#1236
- nested transactions rspec-rails issue with fruitful discussion rspec/rspec-rails#2598
- rubocop/rubocop-rails#400 recommends using requires_new: true
- rubocop/rubocop-rails#414 a corresponding cop (closed as stale)
| end | ||
| ---- | ||
|
|
||
| === Nested Transactions [[nested-transactions]] |
There was a problem hiding this comment.
Similar to what I said in the corresponding RuboCop PR, I think we could group this into a section about avoiding private APIs.
There was a problem hiding this comment.
Thank you for your suggestion.
However, there may be different reasons why private APIs should not be used, so I'm wondering if it's appropriate to group them all in one section.
There was a problem hiding this comment.
I think the section should remain as it is because the focus should be more on the issues that arise with nested transactions rather than the use of private APIs.
@wata727 I’ve been reading your blog, and I was wondering if you could elaborate a bit more on after_commit in this style guide?
There was a problem hiding this comment.
I'm thinking about this PR again now, and I'm beginning to think that the section might not be suitable as a "style guide." I believe it’s worth having RuboCop find the problems caused by joinable: false, but it might be endless to list all such problems in the style guide.
@koic Is there a chance we could add a cop without adding it to the style guide, or do you think problems like this are worth mentioning in the style guide?
See also rubocop/rubocop-rails#1236