patman: Provide an option to run in single-threaded mode

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>
This commit is contained in:
Simon Glass 2025-04-29 07:22:25 -06:00
parent 45f4f62191
commit 52aef33f95
3 changed files with 7 additions and 4 deletions

View 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)

View 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

View 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):