Add comprehensive test suite for image processing and related services
- Implement tests for database generator to ensure proper session handling. - Create tests for EXIF extraction and conversion functions. - Add tests for image-related endpoints, ensuring proper data retrieval and isolation between clients. - Develop tests for OCR functionality, including language detection and text extraction. - Introduce tests for the image processing pipeline, covering success and failure scenarios. - Validate rate limiting functionality and ensure independent counters for different clients. - Implement scraper tests to verify HTML content fetching and error handling. - Add unit tests for various services, including storage and filename generation. - Establish worker entry point for ARQ to handle background image processing tasks.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
Client Redis partagé — pool de connexions async pour ARQ et Pub/Sub.
|
||||
"""
|
||||
from redis.asyncio import ConnectionPool, Redis
|
||||
|
||||
from app.config import settings
|
||||
|
||||
_pool: ConnectionPool | None = None
|
||||
|
||||
|
||||
async def get_redis_pool() -> Redis:
|
||||
"""Retourne un client Redis avec pool de connexions partagé."""
|
||||
global _pool
|
||||
if _pool is None:
|
||||
_pool = ConnectionPool.from_url(
|
||||
settings.REDIS_URL,
|
||||
max_connections=20,
|
||||
decode_responses=True,
|
||||
)
|
||||
return Redis(connection_pool=_pool)
|
||||
|
||||
|
||||
async def close_redis_pool() -> None:
|
||||
"""Ferme proprement le pool de connexions Redis."""
|
||||
global _pool
|
||||
if _pool is not None:
|
||||
await _pool.disconnect()
|
||||
_pool = None
|
||||
Reference in New Issue
Block a user