INNER CODE UNIT · Python
update_user_activity
pgalko/BambooAI · web_app/app.py:186
def update_user_activity(user_id: str):
"""Update user activity in orchestrator"""
try:
if ORCHESTRATOR_API_URL and GLOBAL_EXECUTION_MODE == 'api' and not DIRECT_EXECUTOR_URL: # only the orchestrated path has an idle reaper
response = requests.post(
f"{ORCHESTRATOR_API_URL}/activity/{user_id}",
timeout=3
)
if response.status_code == 200:
logger.debug(f"Updated activity for user {user_id}")
except Exception as e:
# Don't break the request if activity tracking fails
logger.debug(f"Activity tracking failed for user {user_id}: {e}")
# Seconds of silence on a streaming response before a newline is sent. Well
# under nginx's proxy_read_timeout, so a working run never looks like a dead
# one. Purely a keepalive: the client ignores blank lines.
STREAM_HEARTBEAT_SECONDS = float(os.getenv("STREAM_HEARTBEAT_SECONDS", "15"))