Fix: Remove invalid 'show' param from ui.run_with(), fix mypy errors in cache.py, fix docker-compose volume mount
This commit is contained in:
@@ -162,7 +162,6 @@ ui.run_with(
|
|||||||
app,
|
app,
|
||||||
mount_path=settings.nicegui_mount_path,
|
mount_path=settings.nicegui_mount_path,
|
||||||
storage_secret=settings.nicegui_storage_secret,
|
storage_secret=settings.nicegui_storage_secret,
|
||||||
show=False,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ from typing import Any
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from redis.asyncio import Redis
|
from redis.asyncio import Redis as RedisClient
|
||||||
except ImportError: # pragma: no cover - optional dependency
|
except ImportError: # pragma: no cover - optional dependency
|
||||||
Redis = None
|
RedisClient = None # type: ignore[misc,assignment]
|
||||||
|
|
||||||
|
|
||||||
class CacheService:
|
class CacheService:
|
||||||
@@ -21,8 +21,8 @@ class CacheService:
|
|||||||
def __init__(self, url: str | None, default_ttl: int = 300) -> None:
|
def __init__(self, url: str | None, default_ttl: int = 300) -> None:
|
||||||
self.url = url
|
self.url = url
|
||||||
self.default_ttl = default_ttl
|
self.default_ttl = default_ttl
|
||||||
self._client: Redis | None = None
|
self._client: RedisClient | None = None
|
||||||
self._enabled = bool(url and Redis)
|
self._enabled = bool(url and RedisClient)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def enabled(self) -> bool:
|
def enabled(self) -> bool:
|
||||||
@@ -30,12 +30,12 @@ class CacheService:
|
|||||||
|
|
||||||
async def connect(self) -> None:
|
async def connect(self) -> None:
|
||||||
if not self._enabled:
|
if not self._enabled:
|
||||||
if self.url and Redis is None:
|
if self.url and RedisClient is None:
|
||||||
logger.warning("Redis URL configured but redis package is not installed; cache disabled")
|
logger.warning("Redis URL configured but redis package is not installed; cache disabled")
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._client = Redis.from_url(self.url, decode_responses=True)
|
self._client = RedisClient.from_url(self.url, decode_responses=True) # type: ignore[misc]
|
||||||
await self._client.ping()
|
await self._client.ping()
|
||||||
logger.info("Connected to Redis cache")
|
logger.info("Connected to Redis cache")
|
||||||
except Exception as exc: # pragma: no cover - network dependent
|
except Exception as exc: # pragma: no cover - network dependent
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ services:
|
|||||||
UVICORN_WORKERS: 1
|
UVICORN_WORKERS: 1
|
||||||
RUN_MIGRATIONS: 0
|
RUN_MIGRATIONS: 0
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/app
|
- ./app:/app/app
|
||||||
|
- ./config:/app/config
|
||||||
depends_on:
|
depends_on:
|
||||||
redis:
|
redis:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|||||||
Reference in New Issue
Block a user