From 85dffd0b24147e59f5c6d888a21528774feec702 Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Wed, 18 Feb 2026 08:14:48 -0500 Subject: [PATCH] add debug logging to backfill: bucket, key, s3_path, and work item counts --- make_post_sell/lib/karaoke.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/make_post_sell/lib/karaoke.py b/make_post_sell/lib/karaoke.py index 1d04e5b..f285d12 100644 --- a/make_post_sell/lib/karaoke.py +++ b/make_post_sell/lib/karaoke.py @@ -41,6 +41,8 @@ def process_karaoke(s3_client, bucket, s3_key, s3_path, 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) + with tempfile.TemporaryDirectory(prefix="karaoke_") as tmpdir: # 1. Download original from S3 (get_object, not download_file — # download_file uses boto3 TransferManager which spawns threads @@ -201,7 +203,9 @@ def backfill_karaoke_async(shop_id, session_factory, app_settings): # Collect work items work = [] + skipped_existing = 0 products = session.query(Product).filter(Product.shop_id == shop_id).all() + log.info("Backfill: %d total products for shop %s", len(products), shop.name) for product in products: for file_key in ("product", "preview"): ext = product.extensions.get(file_key) @@ -211,8 +215,11 @@ def backfill_karaoke_async(shop_id, session_factory, app_settings): if media_type not in ("video", "audio"): continue if tracks_exist(s3, bucket, product.s3_path): + skipped_existing += 1 continue work.append((product.id, product.s3_path, product.title, file_key, ext, media_type)) + log.info("Backfill: %d audio/video items, %d already have tracks, %d to process", + len(work) + skipped_existing, skipped_existing, len(work)) if not work: log.info("No products need backfill for shop %s", shop.name)