From 61d38e4ffca2a006a6af68ca6f0107c4ef307aab Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Wed, 17 Jun 2026 13:14:37 +0200 Subject: [PATCH] Periodically write a /tmp/heartbeat file in the bugbug http service worker To be used in a liveness probe --- http_service/bugbug_http/worker.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/http_service/bugbug_http/worker.py b/http_service/bugbug_http/worker.py index 888979319e..31e178ec35 100644 --- a/http_service/bugbug_http/worker.py +++ b/http_service/bugbug_http/worker.py @@ -6,6 +6,9 @@ import os import sys +import threading +import time +from pathlib import Path from urllib.parse import urlparse from redis import Redis @@ -40,6 +43,13 @@ def main(): # Write readiness probe file. open("/tmp/ready", "w").close() + def write_heartbeat(): + while True: + Path("/tmp/heartbeat").touch() + time.sleep(15) + + threading.Thread(target=write_heartbeat, daemon=True).start() + w.work()