fix(portal): resolve 10+ sec link delay by fixing Garage S3 secret key, adding 1s boto3 timeouts, and running S3 list calls in parallel

This commit is contained in:
2026-10-29 16:43:24 +11:00
parent 3bf3ea798f
commit aef12aafd8
2 changed files with 13 additions and 5 deletions

View File

@@ -11,6 +11,7 @@ Every page renders against the design tokens in static/tokens.css.
"""
from __future__ import annotations
import asyncio
import logging
from datetime import datetime, timezone
from zoneinfo import ZoneInfo
@@ -206,11 +207,13 @@ async def tool_embed(request: Request, tool_id: str) -> HTMLResponse:
return templates.TemplateResponse(
request, "not_found.html", {"user": user}, status_code=404
)
# Workspace files: the user's bucket + the shared pool (does not block the
# event loop, degrades to empty list on any S3 error).
# Workspace files: the user's bucket + the shared pool (runs concurrently,
# degraded gracefully on any S3 error/timeout).
user_bucket = s3_bucket_name(user.username)
my_files = await run_in_threadpool(list_recent, user_bucket, 20)
shared_files = await run_in_threadpool(list_recent, "shared-media", 20)
my_files, shared_files = await asyncio.gather(
run_in_threadpool(list_recent, user_bucket, 20),
run_in_threadpool(list_recent, "shared-media", 20),
)
ctx = {
"user": user,
"tool": tool,