mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-25 11:04:07 +00:00
Properly track uploaded logos in Redis so avoid redundant message from file scanner.
This commit is contained in:
parent
a7b9d278c2
commit
9c32cc68d9
1 changed files with 12 additions and 0 deletions
|
|
@ -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={
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue