mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
ruff: Fix S108 Probable insecure usage of temporary file.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
d05f672132
commit
7e3a681f80
@@ -85,7 +85,8 @@ def tracemalloc_listen() -> None:
|
||||
listener_pid = os.getpid()
|
||||
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
|
||||
path = f"/tmp/tracemalloc.{os.getpid()}"
|
||||
os.makedirs(settings.TRACEMALLOC_DUMP_DIR, exist_ok=True)
|
||||
path = os.path.join(settings.TRACEMALLOC_DUMP_DIR, f"tracemalloc.{os.getpid()}")
|
||||
sock.bind(path)
|
||||
thread = threading.Thread(target=lambda: tracemalloc_listen_sock(sock), daemon=True)
|
||||
thread.start()
|
||||
@@ -96,7 +97,7 @@ def maybe_tracemalloc_listen() -> None:
|
||||
"""If tracemalloc tracing enabled, listen for requests to dump a snapshot.
|
||||
|
||||
To trigger once this is listening:
|
||||
echo | socat -u stdin unix-sendto:/tmp/tracemalloc.$pid
|
||||
echo | socat -u stdin unix-sendto:/var/log/zulip/tracemalloc/tracemalloc.$pid
|
||||
|
||||
To enable in the Zulip web server: edit /etc/zulip/uwsgi.ini ,
|
||||
and add e.g. ` PYTHONTRACEMALLOC=5` to the `env=` line.
|
||||
|
||||
Reference in New Issue
Block a user