Increase Virus Scan timeout

Added Log info
Updated Compose file
Removed Unused imports in urls
This commit is contained in:
Devoalda 2023-10-31 13:30:38 +08:00
parent 777196355c
commit 08e4d64658
4 changed files with 6 additions and 5 deletions

View File

@ -19,7 +19,7 @@ services:
ports:
- "8000:8000" # Map container port 8000 to host port 8000
environment:
- DEBUG=FALSE
- DEBUG=True
- SECRET_KEY=A_RANDOM_SECRET_KEY
- ALLOWED_HOSTS=*
- CACHE=True
@ -27,6 +27,7 @@ services:
- REDIS_PORT=6379
- REDIS_DB=0
- TRASH_TIMEOUT=60
- DJANGO_LOG_LEVEL=INFO
depends_on:
- redis
networks:

View File

@ -16,8 +16,6 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path, include
from safeshare_app.utils.TrashCollector import TrashCollector
import threading
urlpatterns = [

View File

@ -9,10 +9,12 @@ class Client:
self.stub = pb2_grpc.Dynamo_DBStub(self.channel)
def CheckFile(self, sha_256_id: str):
print(f"Checking file {sha_256_id} with hash signature {sha_256_id}")
response = self.stub.CheckHash(pb2.Request(file_hash=sha_256_id))
return response.is_exist
def UpdateFile(self, sha_256_id: str):
print(f"Updating file {sha_256_id} with hash signature {sha_256_id}")
response = self.stub.UpdateHash(pb2.Request(file_hash=sha_256_id))
return response.is_exist

View File

@ -22,7 +22,7 @@ logger = logging.getLogger(__name__)
class ManageItemsView(APIView):
TIMEOUT = 5
TIMEOUT = 20 # seconds
def post(self, request):
files = request.FILES.getlist('file')
@ -80,7 +80,7 @@ class ManageItemsView(APIView):
try:
grpc_client = client.Client()
result = grpc_client.CheckFile(hash_signature)
result = grpc_client.CheckFile(hash_signature, timeout=10)
except Exception as e:
result = False