]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
patman: Provide an option to run in single-threaded mode
authorSimon Glass <sjg@chromium.org>
Tue, 29 Apr 2025 13:22:25 +0000 (07:22 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 27 May 2025 09:07:41 +0000 (10:07 +0100)
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 <sjg@chromium.org>
tools/patman/cmdline.py
tools/patman/control.py
tools/patman/patchwork.py

index a7327a20665aca731ef6a339fd82d2078bab497d..cf32716b8e08a4c4635bfecab89e63261f98fa0b 100644 (file)
@@ -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)
index cb8552ed5501a8ec96d24cad8090211f2581acbc..cfea35ea648cc16eb899f827586d907b65e5f05c 100644 (file)
@@ -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
index 2b7734bbfe478107c4ea18c604935bba3e1b91c6..47d7be28fdf739667ed489eed95aa15658cabee4 100644 (file)
@@ -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):