Skip to content

A platform for community discussion. Free, open, simple.

DEV: Configure mini profiler storage expiry via an environment variable (#45323)

Alan Guo Xiang Tan73ffe38300df
diff --git a/config/initializers/006-mini_profiler.rb b/config/initializers/006-mini_profiler.rb
index 77cf220baee..3db5fb11720 100644
--- a/config/initializers/006-mini_profiler.rb
+++ b/config/initializers/006-mini_profiler.rb
@@ -22,7 +22,10 @@ if defined?(Rack::MiniProfiler) && defined?(Rack::MiniProfiler::Config)
#
# namespacing gets complex, cause mini profiler is in the rack chain way before multisite
Rack::MiniProfiler.config.storage_instance =
- Rack::MiniProfiler::RedisStore.new(connection: DiscourseRedis.new(nil, namespace: false))
+ Rack::MiniProfiler::RedisStore.new(
+ connection: DiscourseRedis.new(nil, namespace: false),
+ expires_in: ENV["DISCOURSE_MINI_PROFILER_STORAGE_EXPIRY_SECONDS"]&.to_i,
+ )
Rack::MiniProfiler.config.snapshot_every_n_requests = GlobalSetting.mini_profiler_snapshots_period
Rack::MiniProfiler.config.snapshots_transport_destination_url =