Skip to content

Commit a6b48c0

Browse files
Fix cache error handling and Pydantic config deprecation
Co-authored-by: danielnovais-tech <230455320+danielnovais-tech@users.noreply.github.com>
1 parent 1abfff0 commit a6b48c0

4 files changed

Lines changed: 12 additions & 8 deletions

File tree

backend/core/cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def set(self, key: str, value: Any, ttl: Optional[int] = None) -> bool:
6666
else:
6767
client.set(key, serialized)
6868
return True
69-
except (redis.RedisError, json.JSONEncodeError):
69+
except (redis.RedisError, TypeError):
7070
# If cache fails, continue without caching
7171
return False
7272

backend/core/config.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ class Settings(BaseSettings):
4242
num_workers: int = 4
4343
enable_parallel: bool = True
4444

45-
class Config:
46-
env_file = ".env"
47-
case_sensitive = False
45+
model_config = {"env_file": ".env", "case_sensitive": False}
4846

4947

5048
settings = Settings()

backend/main.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
"""
22
Main FastAPI application for satellite tracking system.
33
"""
4+
import sys
5+
import os
6+
7+
# Add parent directory to path when running as script
8+
if __name__ == "__main__":
9+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
10+
411
from fastapi import FastAPI
512
from fastapi.middleware.cors import CORSMiddleware
613
from datetime import datetime
@@ -61,8 +68,9 @@ async def health_check():
6168

6269
if __name__ == "__main__":
6370
import uvicorn
71+
6472
uvicorn.run(
65-
"main:app",
73+
"backend.main:app",
6674
host=settings.api_host,
6775
port=settings.api_port,
6876
reload=settings.api_reload

requirements.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,13 @@ python-multipart==0.0.6
3636
pytest==7.4.4
3737
pytest-asyncio==0.23.3
3838
pytest-cov==4.1.0
39-
httpx-mock==0.7.0
4039

4140
# Development
4241
black==24.1.1
4342
flake8==7.0.0
4443
mypy==1.8.0
4544

46-
# CORS
47-
python-cors==1.0.0
45+
4846

4947
# Environment
5048
python-dotenv==1.0.0

0 commit comments

Comments
 (0)