summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-06-21 16:35:14 +0200
committerRémy Coutable <remy@rymai.me>2017-06-21 17:35:29 +0200
commitb8a7b59d82c49c14f4f9a452f99fa7df289c444d (patch)
tree9284356ed6dfcff2f58692e7f0f31e3002d578fc /config
parent0551364c60ff5f27ae10f5d0231bec8144332f5b (diff)
downloadgitlab-ce-b8a7b59d82c49c14f4f9a452f99fa7df289c444d.tar.gz
Add the Flipper::Middleware::Memoizer middleware
This ensures we make maximum one call per feature per request. See https://github.com/jnunemaker/flipper/blob/v0.10.2/docs/Optimization.md#memoizing-middleware Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'config')
-rw-r--r--config/initializers/flipper.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/config/initializers/flipper.rb b/config/initializers/flipper.rb
new file mode 100644
index 00000000000..0fee832788d
--- /dev/null
+++ b/config/initializers/flipper.rb
@@ -0,0 +1,4 @@
+require 'flipper/middleware/memoizer'
+
+Rails.application.config.middleware.use Flipper::Middleware::Memoizer,
+ lambda { Feature.flipper }