uncap concurrency, skip per-item validate_keys in backfill
This commit is contained in:
parent
535e57896b
commit
7e620f39f1
1 changed files with 10 additions and 8 deletions
|
|
@ -23,7 +23,8 @@ VOXSPLIT_SOURCE = os.environ.get(
|
|||
|
||||
|
||||
def process_karaoke(s3_client, bucket, s3_key, s3_path,
|
||||
is_video, extension, public_key=None, secret_key=None):
|
||||
is_video, extension, public_key=None, secret_key=None,
|
||||
skip_validate=False):
|
||||
"""Download from S3 -> process in unsandbox zerotrust -> upload both tracks.
|
||||
|
||||
Produces two files under s3_path:
|
||||
|
|
@ -34,12 +35,12 @@ def process_karaoke(s3_client, bucket, s3_key, s3_path,
|
|||
"""
|
||||
public_key, secret_key = _resolve_credentials(public_key, secret_key)
|
||||
|
||||
# Validate keys are still active before spending time on S3 download
|
||||
try:
|
||||
validate_keys(public_key, secret_key)
|
||||
except Exception as e:
|
||||
log.warning("Unsandbox API keys invalid or expired — skipping: %s", e)
|
||||
return None
|
||||
if not skip_validate:
|
||||
try:
|
||||
validate_keys(public_key, secret_key)
|
||||
except Exception as e:
|
||||
log.warning("Unsandbox API keys invalid or expired — skipping: %s", e)
|
||||
return None
|
||||
|
||||
log.info("process_karaoke: bucket=%s key=%s s3_path=%s", bucket, s3_key, s3_path)
|
||||
|
||||
|
|
@ -234,7 +235,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 = min(2, max(1, int(key_info.get("concurrency", 1))))
|
||||
concurrency = 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
|
||||
|
|
@ -283,6 +284,7 @@ def backfill_karaoke_async(shop_id, session_factory, app_settings):
|
|||
f"{s3_path}/{file_key}",
|
||||
s3_path, is_video, ext,
|
||||
public_key=pk, secret_key=sk,
|
||||
skip_validate=True,
|
||||
)
|
||||
if sizes:
|
||||
return product_id, title, file_key, ext, media_type, sizes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue