From 9c32cc68d97fc0f145661cc33126f9e6aa73b426 Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Sun, 27 Jul 2025 14:55:02 -0500 Subject: [PATCH] Properly track uploaded logos in Redis so avoid redundant message from file scanner. --- apps/channels/api_views.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/channels/api_views.py b/apps/channels/api_views.py index 73c6412e..8f66efa9 100644 --- a/apps/channels/api_views.py +++ b/apps/channels/api_views.py @@ -18,6 +18,7 @@ from apps.accounts.permissions import ( ) from core.models import UserAgent, CoreSettings +from core.utils import RedisClient from .models import ( Stream, @@ -1264,6 +1265,17 @@ class LogoViewSet(viewsets.ModelViewSet): for chunk in file.chunks(): destination.write(chunk) + # Mark file as processed in Redis to prevent file scanner notifications + try: + redis_client = RedisClient.get_client() + if redis_client: + # Use the same key format as the file scanner + redis_key = f"processed_file:{file_path}" + redis_client.setex(redis_key, 60 * 60 * 24 * 3, "api_upload") # 3 day TTL + logger.debug(f"Marked uploaded logo file as processed in Redis: {file_path}") + except Exception as e: + logger.warning(f"Failed to mark logo file as processed in Redis: {e}") + logo, _ = Logo.objects.get_or_create( url=file_path, defaults={