Skip to content

Commit c5e9834

Browse files
committed
Use gettempdir
1 parent 4a34e08 commit c5e9834

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/common/core/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
DEFAULT_PROMETHEUS_MULTIPROC_DIR = "/tmp/flagsmith-prometheus"
1+
DEFAULT_PROMETHEUS_MULTIPROC_DIR_NAME = "flagsmith-prometheus"

src/common/core/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
import shutil
55
import sys
66
import typing
7+
from tempfile import gettempdir
78

89
from django.core.management import (
910
execute_from_command_line as django_execute_from_command_line,
1011
)
1112

1213
from common.core.cli import healthcheck
13-
from common.core.constants import DEFAULT_PROMETHEUS_MULTIPROC_DIR
14+
from common.core.constants import DEFAULT_PROMETHEUS_MULTIPROC_DIR_NAME
1415

1516
logger = logging.getLogger(__name__)
1617

@@ -46,7 +47,7 @@ def ensure_cli_env() -> typing.Generator[None, None, None]:
4647
# Set up Prometheus' multiprocess mode
4748
prometheus_multiproc_dir_name = os.environ.setdefault(
4849
"PROMETHEUS_MULTIPROC_DIR",
49-
DEFAULT_PROMETHEUS_MULTIPROC_DIR,
50+
os.path.join(gettempdir(), DEFAULT_PROMETHEUS_MULTIPROC_DIR_NAME),
5051
)
5152
shutil.rmtree(prometheus_multiproc_dir_name, ignore_errors=True)
5253
os.makedirs(prometheus_multiproc_dir_name, exist_ok=True, mode=0o700)

0 commit comments

Comments
 (0)