From a0e50c0e259f1d63c8e1d9b907921ea780e9602d Mon Sep 17 00:00:00 2001
From: Fabiano Correa Mercer <fabiano.correamercer@windriver.com>
Date: Mon, 4 Nov 2024 16:51:34 -0300
Subject: [PATCH] Increase HTTP Request Timeout for Software Upload

The software upload command fails due to a timeout while waiting for
the HTTP response.
This issue arises specifically when uploading larger patches,
such as a 1GB file, for example:
software upload test.patch

To address this, increasing the timeout to the existing
UPLOAD_REQUEST_TIMEOUT (30 minutes) resolved the problem.
In a VBOX AIO-SX environment, the system required almost 10 minutes
to complete the upload and 7 minutes 30 seconds to delete the patch.

As a potential improvement, implementing the upload as an
asynchronous command could further enhance performance,
especially for large file uploads.

Test Done:

Tested software upload on AIO-SX with a 1GB patch file

Story: 2010676
Task: 51253
Change-Id: I46018bb6b139a0d067a74df2c39e33e0fc4dc347
Signed-off-by: Fabiano Correa Mercer <fabiano.correamercer@windriver.com>
---
 software-client/software_client/common/http.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/software-client/software_client/common/http.py b/software-client/software_client/common/http.py
index 649d195d..fd862cab 100644
--- a/software-client/software_client/common/http.py
+++ b/software-client/software_client/common/http.py
@@ -213,7 +213,7 @@ class SessionClient(adapter.LegacyJsonAdapter):
         if 'body' in kwargs:
             kwargs['data'] = jsonutils.dumps(kwargs.pop('body'))
 
-        resp = self._http_request(url, method, **kwargs)
+        resp = self._http_request(url, method, timeout=UPLOAD_REQUEST_TIMEOUT, **kwargs)
         body = resp.content
         content_type = resp.headers.get('content-type', None)
         status = resp.status_code
@@ -235,7 +235,7 @@ class SessionClient(adapter.LegacyJsonAdapter):
         if 'body' in kwargs:
             kwargs['data'] = kwargs.pop('body')
 
-        resp = self._http_request(url, method, **kwargs)
+        resp = self._http_request(url, method, timeout=UPLOAD_REQUEST_TIMEOUT, **kwargs)
         body = resp.content
         content_type = resp.headers.get('content-type', None)
         status = resp.status_code