From 13fa4d5c02f9627433637707b4391639d67c2581 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 6 Jan 2023 16:38:59 +0100 Subject: [PATCH] GenericDirectUploadService: Use ParallelLimit Instead of subgrouping parallel tasks into groups of MaxConcurrentStatCalls size and running these groups sequentially. The advantage is that now the next task will run just after some task has ended. Before, the next group was run when all tasks in the previous group have finished. Reuses new ParallelLimit functionality introduced here: b6208ab34aa53280f06622edf1e3aa506aed96b6 Amends f2d50ba6ffe9b799e12b3c2adc9d17872315b077 Change-Id: I422c86184d62aefc92d94adb58cdb7b1e38232f2 Reviewed-by: Christian Kandeler --- .../genericdirectuploadservice.cpp | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/plugins/remotelinux/genericdirectuploadservice.cpp b/src/plugins/remotelinux/genericdirectuploadservice.cpp index 2bde15cb4f8..4913a1cafaa 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.cpp +++ b/src/plugins/remotelinux/genericdirectuploadservice.cpp @@ -71,18 +71,6 @@ QList collectFilesToUpload(const DeployableFile &deployable) return collected; } -static Group packIntoOptionalParallelGroups(const QList &tasks) -{ - QList groups; - int i = 0; - while (i < tasks.size()) { - const QList subTasks = tasks.mid(i, MaxConcurrentStatCalls); - i += subTasks.size(); - groups.append(Group { QList {optional, parallel} + subTasks }); - } - return Group { QList {optional} + groups }; -} - } // namespace Internal using namespace Internal; @@ -188,12 +176,12 @@ TaskItem GenericDirectUploadServicePrivate::statTree(const TreeStorage files = filesToStat(storagePtr); - QList statList; + QList statList{optional, ParallelLimit(MaxConcurrentStatCalls)}; for (const DeployableFile &file : std::as_const(files)) { QTC_ASSERT(file.isValid(), continue); statList.append(statTask(storagePtr, file, statEndHandler)); } - tree.setupRoot(packIntoOptionalParallelGroups(statList)); + tree.setupRoot({statList}); }; return Tree(setupHandler); } @@ -273,14 +261,14 @@ TaskItem GenericDirectUploadServicePrivate::chmodTree(const TreeStorage chmodList; + QList chmodList{optional, ParallelLimit(MaxConcurrentStatCalls)}; for (const DeployableFile &file : std::as_const(filesToChmod)) { QTC_ASSERT(file.isValid(), continue); chmodList.append(chmodTask(file)); } - tree.setupRoot(packIntoOptionalParallelGroups(chmodList)); + tree.setupRoot({chmodList}); }; - return Tree {setupChmodHandler}; + return Tree(setupChmodHandler); } Group GenericDirectUploadService::deployRecipe()