From 97df80d36c0e472cd11734e0e10214926839ff40 Mon Sep 17 00:00:00 2001 From: Gary Fan Date: Wed, 13 Nov 2024 17:51:06 +0800 Subject: [PATCH] update scarf_analytics() GET request with timeouts Occasionally in offline environments, scarf_analytics() can block the main process since `unstructured.io` is not accessible yet the GET request did not implement timeout, It will freeze with the following log ``` 2024-11-13 08:45:05.615 | DEBUG | urllib3.connectionpool:_new_conn:1055 - Starting new HTTPS connection (1): packages.unstructured.io:443 ``` --- unstructured/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unstructured/utils.py b/unstructured/utils.py index 523fcd4a01..33fd739e2e 100644 --- a/unstructured/utils.py +++ b/unstructured/utils.py @@ -291,7 +291,8 @@ def scarf_analytics(): + platform.machine() + "&gpu=" + str(gpu_present) - + "&dev=true", + + "&dev=true", + timeout=2 ) else: requests.get( @@ -306,6 +307,7 @@ def scarf_analytics(): + "&gpu=" + str(gpu_present) + "&dev=false", + timeout=2 ) except Exception: pass