Skip to content

Commit

Permalink
fix: can not install app when cancel a task
Browse files Browse the repository at this point in the history
Allow setup different tasks by the same ref.
  • Loading branch information
dengbo11 committed Jan 10, 2025
1 parent 715d3a6 commit 5aa7cbe
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions libs/linglong/src/linglong/package_manager/package_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,28 +171,7 @@ class PackageTaskQueue : public QObject
LINGLONG_TRACE("add new task");
static_assert(std::is_invocable_r_v<void, Func, PackageTask &>,
"mismatch function signature");
auto exist =
std::any_of(m_taskQueue.begin(), m_taskQueue.end(), [&refs](const PackageTask &task) {
QStringList intersection;
std::set_intersection(refs.begin(),
refs.end(),
task.m_refs.begin(),
task.m_refs.end(),
std::back_inserter(intersection));
if (intersection.empty()) {
return false;
}

for (const auto &ref : intersection) {
qWarning() << "ref " << ref << " is operating by task " << task.taskID();
}

return true;
});

if (exist) {
return LINGLONG_ERR("ref conflict");
}

auto &ref = m_taskQueue.emplace_back(conn, refs, std::forward<Func>(job), this);

Q_EMIT taskAdded();
Expand Down

0 comments on commit 5aa7cbe

Please sign in to comment.