From c90effd84a2ed93c356b25f80b708f4df33472b0 Mon Sep 17 00:00:00 2001
From: Aleksei Lipniagov <alipniagov@gitlab.com>
Date: Mon, 12 Aug 2019 12:49:01 +0300
Subject: [PATCH] Clean prometheus dir only for master process

---
 config.ru | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/config.ru b/config.ru
index 530d8e323778..f6a7dca05422 100644
--- a/config.ru
+++ b/config.ru
@@ -29,8 +29,12 @@ def cleanup_prometheus_multiproc_dir
   end
 end
 
+def master_process?
+  Prometheus::PidProvider.worker_id.in? %w(unicorn_master puma_master)
+end
+
 warmup do |app|
-  cleanup_prometheus_multiproc_dir
+  cleanup_prometheus_multiproc_dir if master_process?
 
   client = Rack::MockRequest.new(app)
   client.get('/')
-- 
GitLab