Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/fastcache_api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class CacheRequest(BaseModel):
requested_by: str
# Absolute path the orchestrator dictates for this cache's log.
log_path: Path
# Override for CacheConfig.timeout (fastcache's idle-receive timeout, ms).
idle_timeout_ms: int | None = None


class CachePublic(BaseModel):
Expand Down
6 changes: 6 additions & 0 deletions src/fastcache_api/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,16 @@ async def create_cache(session: AsyncSession, req: CacheRequest) -> CacheCreatio
except RuntimeError as exc:
raise CachePortsExhausted(str(exc)) from exc

timeout = (
req.idle_timeout_ms
if req.idle_timeout_ms is not None
else CacheConfig.model_fields["timeout"].default
)
config = CacheConfig(
hostname=hostname,
pull_uri=f"tcp://{hostname}:{pull_port}",
push_uri=f"tcp://{hostname}:{push_port}",
timeout=timeout,
)

cache_id = uuid4()
Expand Down