fix(cost): use new_event_loop pattern for Whisper cost tracking (matches ingest_and_ai.py)

This commit is contained in:
Vadym Samoilenko 2026-05-14 11:43:20 +01:00
parent 922cb9318e
commit 07d2112e53

View file

@ -212,7 +212,11 @@ def transcribe_video_audio_task(self, job_id: str, audio_path: str) -> dict:
finally:
client.close()
job_doc = asyncio.run(_fetch_job())
loop = asyncio.new_event_loop()
try:
job_doc = loop.run_until_complete(_fetch_job())
finally:
loop.close()
user_id = str(job_doc.get("created_by", "")) if job_doc else ""
project_id = str(job_doc.get("cost_tracker_project_id", "")) if job_doc else ""
cost_tracker.record(