From dc08714365707b4f83ba2faeefb6c3b5c3a30529 Mon Sep 17 00:00:00 2001 From: james Hart Date: Mon, 3 Mar 2025 16:18:10 +0000 Subject: [PATCH] include psutil for process memory management --- health_ping.py | 4 +++- requirements.txt | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/health_ping.py b/health_ping.py index 4ce4d58..855967c 100755 --- a/health_ping.py +++ b/health_ping.py @@ -2,6 +2,7 @@ """Health ping - fetches all /health and /info endpoints and stores the results in Redis""" from datetime import datetime, timezone +import psutil import os import threading import logging @@ -32,6 +33,7 @@ GITHUB_APP_INSTALLATION_ID = int(os.getenv('GITHUB_APP_INSTALLATION_ID')) GITHUB_APP_PRIVATE_KEY = os.getenv('GITHUB_APP_PRIVATE_KEY') + # limit results for testing/dev # See strapi filter syntax https://docs.strapi.io/dev-docs/api/rest/filters-locale-publication # Example filter string = '&filters[name][$contains]=example' @@ -267,7 +269,7 @@ def startHttpServer(): format='[%(asctime)s] %(levelname)s %(threadName)s %(message)s', level=log_level ) log = logging.getLogger(__name__) - + process = psutil.Process(os.getpid()) main_threads = list() http_thread = list() # Start health endpoint. diff --git a/requirements.txt b/requirements.txt index 119c52a..91a401e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ redis==4.6.0 requests==2.31.0 PyGithub==1.59.1 +psutil>=7.0.0 \ No newline at end of file