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,
|
||||
mount_path=settings.nicegui_mount_path,
|
||||
storage_secret=settings.nicegui_storage_secret,
|
||||
show=False,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ from typing import Any
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
from redis.asyncio import Redis
|
||||
from redis.asyncio import Redis as RedisClient
|
||||
except ImportError: # pragma: no cover - optional dependency
|
||||
Redis = None
|
||||
RedisClient = None # type: ignore[misc,assignment]
|
||||
|
||||
|
||||
class CacheService:
|
||||
@@ -21,8 +21,8 @@ class CacheService:
|
||||
def __init__(self, url: str | None, default_ttl: int = 300) -> None:
|
||||
self.url = url
|
||||
self.default_ttl = default_ttl
|
||||
self._client: Redis | None = None
|
||||
self._enabled = bool(url and Redis)
|
||||
self._client: RedisClient | None = None
|
||||
self._enabled = bool(url and RedisClient)
|
||||
|
||||
@property
|
||||
def enabled(self) -> bool:
|
||||
@@ -30,12 +30,12 @@ class CacheService:
|
||||
|
||||
async def connect(self) -> None:
|
||||
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")
|
||||
return
|
||||
|
||||
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()
|
||||
logger.info("Connected to Redis cache")
|
||||
except Exception as exc: # pragma: no cover - network dependent
|
||||
|
||||
Reference in New Issue
Block a user