Increase Virus Scan timeout
Added Log info Updated Compose file Removed Unused imports in urls
This commit is contained in:
parent
777196355c
commit
08e4d64658
|
@ -19,7 +19,7 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000" # Map container port 8000 to host port 8000
|
- "8000:8000" # Map container port 8000 to host port 8000
|
||||||
environment:
|
environment:
|
||||||
- DEBUG=FALSE
|
- DEBUG=True
|
||||||
- SECRET_KEY=A_RANDOM_SECRET_KEY
|
- SECRET_KEY=A_RANDOM_SECRET_KEY
|
||||||
- ALLOWED_HOSTS=*
|
- ALLOWED_HOSTS=*
|
||||||
- CACHE=True
|
- CACHE=True
|
||||||
|
@ -27,6 +27,7 @@ services:
|
||||||
- REDIS_PORT=6379
|
- REDIS_PORT=6379
|
||||||
- REDIS_DB=0
|
- REDIS_DB=0
|
||||||
- TRASH_TIMEOUT=60
|
- TRASH_TIMEOUT=60
|
||||||
|
- DJANGO_LOG_LEVEL=INFO
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
networks:
|
networks:
|
||||||
|
|
|
@ -16,8 +16,6 @@ Including another URLconf
|
||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
from safeshare_app.utils.TrashCollector import TrashCollector
|
|
||||||
import threading
|
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|
|
@ -9,10 +9,12 @@ class Client:
|
||||||
self.stub = pb2_grpc.Dynamo_DBStub(self.channel)
|
self.stub = pb2_grpc.Dynamo_DBStub(self.channel)
|
||||||
|
|
||||||
def CheckFile(self, sha_256_id: str):
|
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))
|
response = self.stub.CheckHash(pb2.Request(file_hash=sha_256_id))
|
||||||
return response.is_exist
|
return response.is_exist
|
||||||
|
|
||||||
def UpdateFile(self, sha_256_id: str):
|
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))
|
response = self.stub.UpdateHash(pb2.Request(file_hash=sha_256_id))
|
||||||
return response.is_exist
|
return response.is_exist
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ManageItemsView(APIView):
|
class ManageItemsView(APIView):
|
||||||
TIMEOUT = 5
|
TIMEOUT = 20 # seconds
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
files = request.FILES.getlist('file')
|
files = request.FILES.getlist('file')
|
||||||
|
@ -80,7 +80,7 @@ class ManageItemsView(APIView):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
grpc_client = client.Client()
|
grpc_client = client.Client()
|
||||||
result = grpc_client.CheckFile(hash_signature)
|
result = grpc_client.CheckFile(hash_signature, timeout=10)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
result = False
|
result = False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue