forked from qt-creator/qt-creator
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:b6208ab34a
Amendsf2d50ba6ff
Change-Id: I422c86184d62aefc92d94adb58cdb7b1e38232f2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -71,18 +71,6 @@ QList<DeployableFile> collectFilesToUpload(const DeployableFile &deployable)
|
||||
return collected;
|
||||
}
|
||||
|
||||
static Group packIntoOptionalParallelGroups(const QList<TaskItem> &tasks)
|
||||
{
|
||||
QList<TaskItem> groups;
|
||||
int i = 0;
|
||||
while (i < tasks.size()) {
|
||||
const QList<TaskItem> subTasks = tasks.mid(i, MaxConcurrentStatCalls);
|
||||
i += subTasks.size();
|
||||
groups.append(Group { QList<TaskItem> {optional, parallel} + subTasks });
|
||||
}
|
||||
return Group { QList<TaskItem> {optional} + groups };
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
using namespace Internal;
|
||||
@@ -188,12 +176,12 @@ TaskItem GenericDirectUploadServicePrivate::statTree(const TreeStorage<UploadSto
|
||||
const auto setupHandler = [=](TaskTree &tree) {
|
||||
UploadStorage *storagePtr = storage.activeStorage();
|
||||
const QList<DeployableFile> files = filesToStat(storagePtr);
|
||||
QList<TaskItem> statList;
|
||||
QList<TaskItem> 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<UploadSt
|
||||
if (file.isExecutable())
|
||||
filesToChmod << file;
|
||||
}
|
||||
QList<TaskItem> chmodList;
|
||||
QList<TaskItem> 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()
|
||||
|
Reference in New Issue
Block a user