Skip to content

Commit

Permalink
Handle subprocess.TimeoutExpired
Browse files Browse the repository at this point in the history
  • Loading branch information
gdesmar committed Mar 26, 2024
1 parent 407866c commit 58d5bad
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion urldownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,14 @@ def execute(self, request: ServiceRequest) -> None:
]
if self.no_sandbox:
kangooroo_args.insert(-2, "--no-sandbox")
subprocess.run(kangooroo_args, cwd=KANGOOROO_FOLDER, capture_output=True, timeout=self.request_timeout)
try:
subprocess.run(kangooroo_args, cwd=KANGOOROO_FOLDER, capture_output=True, timeout=self.request_timeout)
except subprocess.TimeoutExpired:
timeout_section = ResultTextSection("Request timed out", parent=request.result)
timeout_section.add_line(
f"Timeout of {self.request_timeout} seconds was not enough to process the query fully."
)
return

url_md5 = hashlib.md5(request.task.fileinfo.uri_info.uri.encode()).hexdigest()

Expand Down

0 comments on commit 58d5bad

Please sign in to comment.