Add debug logging to resolve_asset
This commit is contained in:
@@ -43,15 +43,19 @@ def resolve_asset(ref: str, actor_id: Optional[str] = None) -> Optional[Path]:
|
||||
Path to the asset file, or None if not found
|
||||
"""
|
||||
global _resolve_loop, _db_initialized
|
||||
import sys
|
||||
print(f"RESOLVE_ASSET: ref={ref}, actor_id={actor_id}", file=sys.stderr)
|
||||
cache_mgr = get_cache_manager()
|
||||
|
||||
# Try as direct CID first
|
||||
path = cache_mgr.get_by_cid(ref)
|
||||
print(f"RESOLVE_ASSET: get_by_cid({ref}) = {path}", file=sys.stderr)
|
||||
if path and path.exists():
|
||||
logger.info(f"Resolved {ref[:16]}... as CID to {path}")
|
||||
return path
|
||||
|
||||
# Try as friendly name if actor_id provided
|
||||
print(f"RESOLVE_ASSET: trying friendly name lookup, actor_id={actor_id}", file=sys.stderr)
|
||||
if actor_id:
|
||||
import asyncio
|
||||
import database
|
||||
@@ -70,13 +74,17 @@ def resolve_asset(ref: str, actor_id: Optional[str] = None) -> Optional[Path]:
|
||||
_db_initialized = True
|
||||
|
||||
cid = _resolve_loop.run_until_complete(resolve_friendly_name(actor_id, ref))
|
||||
print(f"RESOLVE_ASSET: resolve_friendly_name({actor_id}, {ref}) = {cid}", file=sys.stderr)
|
||||
|
||||
if cid:
|
||||
path = cache_mgr.get_by_cid(cid)
|
||||
print(f"RESOLVE_ASSET: get_by_cid({cid}) = {path}", file=sys.stderr)
|
||||
if path and path.exists():
|
||||
print(f"RESOLVE_ASSET: SUCCESS - resolved to {path}", file=sys.stderr)
|
||||
logger.info(f"Resolved '{ref}' via friendly name to {path}")
|
||||
return path
|
||||
except Exception as e:
|
||||
print(f"RESOLVE_ASSET: ERROR - {e}", file=sys.stderr)
|
||||
logger.warning(f"Failed to resolve friendly name '{ref}': {e}")
|
||||
|
||||
logger.warning(f"Could not resolve asset reference: {ref}")
|
||||
|
||||
Reference in New Issue
Block a user