Replaces 20+ second job polling with instant folder search.
PERFORMANCE IMPROVEMENT:
Before: Poll job 10 times, 2 sec each = 20+ seconds per upload
After: No polling, instant return + optional folder search
CHANGES:
1. Removed job polling from upload_asset()
- No more 20 second waits
- Returns job_id immediately for async uploads
- Adds 'is_async' flag to response
2. NEW METHOD: find_asset_by_filename_in_folder()
- Fast search by filename in folder
- Can be called after batch uploads complete
- Returns actual asset ID instantly
UPLOAD FLOW:
Immediate Response (201):
→ Returns asset ID immediately
→ Log: "Upload successful (immediate): file.jpg → Asset ID: abc123"
Async Response (202):
→ Returns job ID immediately (no waiting!)
→ Log: "Upload accepted (async): file.jpg → Job ID: job456"
→ Log: "Note: Job processing in background. Asset ID can be found later."
FINDING ASSET ID LATER (OPTIONAL):
After batch uploads, call once per folder:
```python
# Upload all files first (fast!)
for file in files:
result = dam.upload_asset(...)
job_ids.append(result['job_id'])
# Then search folder for actual IDs (one API call)
for filename in filenames:
asset_id = dam.find_asset_by_filename_in_folder(folder_id, filename)
```
BENEFITS:
✓ No 20 second waits per file
✓ Batch uploads can run quickly
✓ Optional post-upload search for asset IDs
✓ Single API call to get all IDs
USE CASES:
- Fast uploads: Don't need immediate asset ID
- Batch processing: Upload many files quickly
- Later retrieval: Search folder when needed
- Status updates: Can update campaign without waiting
The job_id is stored and can be used for tracking.
Actual asset_id can be retrieved later if needed.
Changes:
- scripts/shared/dam_client.py
- Removed polling from upload_asset()
- Added find_asset_by_filename_in_folder() method
- Returns immediately with job_id for async
- Added 'is_async' flag to response
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| __pycache__ | ||
| __init__.py | ||
| box_client.py | ||
| config_loader.py | ||
| dam_client.py | ||
| database.py | ||
| filename_parser.py | ||
| metadata_extractor_mvp.py | ||
| notifier.py | ||