Skip to content

Commit

Permalink
Streaming uploading seems to cause hanging on
Browse files Browse the repository at this point in the history
  • Loading branch information
kam193 committed Jan 10, 2025
1 parent 77f2596 commit 5da7581
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion remoteav/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2
3
6 changes: 4 additions & 2 deletions remoteav/service/al_run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import random
import time

import requests
from assemblyline_v4_service.common.base import ServiceBase
Expand Down Expand Up @@ -39,10 +40,12 @@ def execute(self, request: ServiceRequest) -> None:
url = random.choice(self.url)
self.log.debug("Selected service URL: %s", url)
av_response = requests.post(
f"{url}/scan-file", files={"file": open(request.file_path, "rb")}, stream=True
f"{url}/scan-file", files={"file": open(request.file_path, "rb")}
)
# kind of a hacky retry for uploading issues
if av_response.status_code == 504:
self.log.warning("Remote AV server is busy or network has issues, retrying...")
time.sleep(random.uniform(0.1, 1))
continue
break

Expand All @@ -57,5 +60,4 @@ def execute(self, request: ServiceRequest) -> None:
main_section.add_tag("av.virus_name", av_result["av_result"])
main_section.set_heuristic(1)

main_section = ResultTextSection("Results of scoring")
result.add_section(main_section)
3 changes: 2 additions & 1 deletion remoteav/service_manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ heuristics:
docker_config:
image: ${REGISTRY}ghcr.io/kam193/assemblyline-service-remoteav:$SERVICE_TAG
cpu_cores: 0.25
ram_mb: 512
# has to be able to read the file to scan
ram_mb: 768
ram_mb_min: 256
allow_internet_access: true

0 comments on commit 5da7581

Please sign in to comment.