diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-06 18:08:09 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-06 18:08:09 +0000 |
commit | 1287690a3678ad0ec21c9b2f3b21ae18257d5e22 (patch) | |
tree | 96162972275004dcaef6376fe324ee2a7a549833 /lib | |
parent | d4806ad7dbd2d87ae09872709fef1aef35792e21 (diff) | |
download | gitlab-ce-1287690a3678ad0ec21c9b2f3b21ae18257d5e22.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/database/query_analyzers/base.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/gitlab/database/query_analyzers/base.rb b/lib/gitlab/database/query_analyzers/base.rb index 5f321ece962..9a52a4f6e23 100644 --- a/lib/gitlab/database/query_analyzers/base.rb +++ b/lib/gitlab/database/query_analyzers/base.rb @@ -8,7 +8,7 @@ module Gitlab QueryAnalyzerError = Class.new(Exception) # rubocop:disable Lint/InheritException def self.suppressed? - Thread.current[self.suppress_key] + Thread.current[self.suppress_key] || @suppress_in_rspec end def self.requires_tracking?(parsed) @@ -19,6 +19,20 @@ module Gitlab Thread.current[self.suppress_key] = value end + # The other suppress= method stores the + # value in Thread.current because it is + # meant to work in a multi-threaded puma + # environment but this does not work + # correctly in capybara tests where we + # suppress in the rspec runner context but + # this does not take effect in the puma + # thread. As such we just suppress + # globally in RSpec since we don't run + # different tests concurrently. + class << self + attr_writer :suppress_in_rspec + end + def self.with_suppressed(value = true, &blk) previous = self.suppressed? self.suppress = value |