throttle backfill to 1 worker, increase stderr log to 2000 chars

4 concurrent workers was overwhelming the unsandbox API (429/502).
Cap at 1 worker for now. Also increase stderr truncation from 500
to 2000 chars to see full ffmpeg errors.
This commit is contained in:
russell@unturf.com 2026-02-18 19:16:22 -05:00
parent 2908511a8c
commit e1abca4a66

View file

@ -102,7 +102,7 @@ def process_karaoke(s3_client, bucket, s3_key, s3_path,
return None
if not result.get("success") or result.get("exit_code") != 0:
log.warning("Unsandbox execute non-zero exit: success=%s exit_code=%s stdout=%.500s stderr=%.500s",
log.warning("Unsandbox execute non-zero exit: success=%s exit_code=%s stdout=%.2000s stderr=%.2000s",
result.get("success"), result.get("exit_code"),
result.get("stdout", ""), result.get("stderr", ""))
return None
@ -234,7 +234,7 @@ def backfill_karaoke_async(shop_id, session_factory, app_settings):
# Query account concurrency from unsandbox API — abort if keys are bad
try:
key_info = validate_keys(pk, sk)
concurrency = max(1, int(key_info.get("concurrency", 1)))
concurrency = min(1, max(1, int(key_info.get("concurrency", 1))))
except Exception as e:
log.error("Backfill aborted — unsandbox keys invalid or expired for shop %s: %s", shop.name, e)
return