# HG changeset patch
# User Clemens Beck <cbeck@gitlab.com>
# Date 1701373323 0
#      Thu Nov 30 19:42:03 2023 +0000
# Node ID af25508873e4e222c3472b847dea64e17445fb8d
# Parent  91129c6a304bd32240146d404f38819a086ed7c2
Do not scan entire /var/opt/gitlab for stale pids

Fixes slow Docker startups because the entire content of
/var/opt/gitlab (including the 'gitlab-rails' directory)
is scanned for pid files.

Fixed by limiting the find maximum depth to 2.

Changelog: fixed

Closes: https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/8323

Relates: https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/6926

diff --git a/docker/assets/wrapper b/docker/assets/wrapper
--- a/docker/assets/wrapper
+++ b/docker/assets/wrapper
@@ -24,7 +24,7 @@
         #  - any (s)ocket or regular (f)ile
         #  - by the name of "*.pid" or "socket.?"
         #  - and delete them
-        find $x \
+        find $x -maxdepth 4 \
             \( \
               -type f \
               -o -type s \