Refactor caching and Telegram integration

- Updated configuration to enforce Redis caching for notified articles, removing memory cache options.
- Enhanced wallamonitor.py to load Redis cache settings and handle errors more effectively.
- Implemented new API endpoints for clearing Redis cache and retrieving Telegram forum topics.
- Improved frontend components to support fetching and displaying available Telegram threads.
- Added functionality for clearing cache from the UI, ensuring better management of notified articles.
This commit is contained in:
Omar Sánchez Pizarro
2026-01-19 21:24:46 +01:00
parent 96db30ff00
commit 5cc96a2371
7 changed files with 382 additions and 88 deletions

View File

@@ -91,15 +91,9 @@ def load_cache_config():
with open(config_path, 'r') as f:
config = yaml.safe_load(f)
cache_config = config.get('cache', {})
cache_type = cache_config.get('type', 'memory')
cache_type = cache_config.get('type', 'redis')
if cache_type == 'memory':
memory_config = cache_config.get('memory', {})
return {
'cache_type': 'memory',
'limit': memory_config.get('limit', 300)
}
elif cache_type == 'redis':
if cache_type == 'redis':
redis_config = cache_config.get('redis', {})
return {
'cache_type': 'redis',
@@ -109,16 +103,22 @@ def load_cache_config():
'redis_password': redis_config.get('password')
}
else:
logger.warning(f"Tipo de cache desconocido: {cache_type}, usando 'memory'")
logger.warning(f"Tipo de cache desconocido: {cache_type}, usando 'redis' por defecto")
return {
'cache_type': 'memory',
'limit': 300
'cache_type': 'redis',
'redis_host': 'localhost',
'redis_port': 6379,
'redis_db': 0,
'redis_password': None
}
except Exception as e:
logger.warning(f"Error cargando configuración de cache, usando valores por defecto (memory): {e}")
logger.warning(f"Error cargando configuración de cache, usando valores por defecto (redis): {e}")
return {
'cache_type': 'memory',
'limit': 300
'cache_type': 'redis',
'redis_host': 'localhost',
'redis_port': 6379,
'redis_db': 0,
'redis_password': None
}
class WorkerManager: