Patman normally sends multiple concurrent requests to the patchwork
server, as this is faster. Provide an option to disable this.

Signed-off-by: Simon Glass <s...@chromium.org>
---

 tools/patman/cmdline.py   | 2 ++
 tools/patman/control.py   | 4 ++--
 tools/patman/patchwork.py | 5 +++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/patman/cmdline.py b/tools/patman/cmdline.py
index a7327a20665..cf32716b8e0 100644
--- a/tools/patman/cmdline.py
+++ b/tools/patman/cmdline.py
@@ -130,6 +130,8 @@ def parse_args():
         help='Name of branch to create with collected responses')
     status.add_argument('-f', '--force', action='store_true',
                         help='Force overwriting an existing branch')
+    status.add_argument('-T', '--single-thread', action='store_true',
+                        help='Disable multithreading when reading patchwork')
 
     # Parse options twice: first to get the project and second to handle
     # defaults properly (which depends on project)
diff --git a/tools/patman/control.py b/tools/patman/control.py
index cb8552ed550..cfea35ea648 100644
--- a/tools/patman/control.py
+++ b/tools/patman/control.py
@@ -44,7 +44,7 @@ def do_send(args):
 
 
 def patchwork_status(branch, count, start, end, dest_branch, force,
-                     show_comments, url):
+                     show_comments, url, single_thread=False):
     """Check the status of patches in patchwork
 
     This finds the series in patchwork using the Series-link tag, checks for 
new
@@ -96,7 +96,7 @@ def patchwork_status(branch, count, start, end, dest_branch, 
force,
     # Allow the series to override the URL
     if 'patchwork_url' in series:
         url = series.patchwork_url
-    pwork = patchwork.Patchwork(url)
+    pwork = patchwork.Patchwork(url, single_thread=single_thread)
 
     # Import this here to avoid failing on other commands if the dependencies
     # are not present
diff --git a/tools/patman/patchwork.py b/tools/patman/patchwork.py
index 2b7734bbfe4..47d7be28fdf 100644
--- a/tools/patman/patchwork.py
+++ b/tools/patman/patchwork.py
@@ -139,7 +139,7 @@ class Review:
 class Patchwork:
     """Class to handle communication with patchwork
     """
-    def __init__(self, url, show_progress=True):
+    def __init__(self, url, show_progress=True, single_thread=False):
         """Set up a new patchwork handler
 
         Args:
@@ -151,7 +151,8 @@ class Patchwork:
         self.proj_id = None
         self.link_name = None
         self._show_progress = show_progress
-        self.semaphore = asyncio.Semaphore(MAX_CONCURRENT)
+        self.semaphore = asyncio.Semaphore(
+            1 if single_thread else MAX_CONCURRENT)
         self.request_count = 0
 
     async def _request(self, client, subpath):
-- 
2.43.0

Reply via email to