summaryrefslogtreecommitdiff
path: root/lib/feature.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/feature.rb')
-rw-r--r--lib/feature.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/feature.rb b/lib/feature.rb
index 749c861d740..cc9c9d44005 100644
--- a/lib/feature.rb
+++ b/lib/feature.rb
@@ -30,7 +30,12 @@ class Feature
end
def persisted_names
- Gitlab::SafeRequestStore[:flipper_persisted_names] ||= FlipperFeature.feature_names
+ Gitlab::SafeRequestStore[:flipper_persisted_names] ||=
+ begin
+ # We saw on GitLab.com, this database request was called 2300
+ # times/s. Let's cache it for a minute to avoid that load.
+ Rails.cache.fetch('flipper:persisted_names', expires_in: 1.minute) { FlipperFeature.feature_names }
+ end
end
def persisted?(feature)