Try a different approach for tars
This commit is contained in:
parent
3bad275726
commit
345081b851
@ -1149,24 +1149,22 @@ std::string CiLogic::queue_pull_tarball(std::vector<std::shared_ptr<PackageConf>
|
||||
std::shared_ptr<Task> tarball_task = std::make_shared<Task>();
|
||||
task_queue->enqueue(
|
||||
job_statuses->at("pull"),
|
||||
[this, r, &task_queue, &tarball_task, job_statuses](std::shared_ptr<Log> log) mutable {
|
||||
std::shared_ptr<PackageConf> pkgconf = log->get_task_context()->get_parent_packageconf();
|
||||
if (pull_project(pkgconf, log)) {
|
||||
task_queue->enqueue(
|
||||
job_statuses->at("tarball"),
|
||||
[this, r](std::shared_ptr<Log> log) mutable {
|
||||
bool tarball_ok = create_project_tarball(r, log);
|
||||
},
|
||||
r
|
||||
);
|
||||
tarball_task = r->get_task_by_jobstatus(job_statuses->at("tarball"));
|
||||
}
|
||||
[this, r](std::shared_ptr<Log> log) mutable {
|
||||
pull_project(r, log);
|
||||
},
|
||||
r
|
||||
);
|
||||
|
||||
new_item->first_pull_task = r->get_task_by_jobstatus(job_statuses->at("pull"));
|
||||
new_item->first_tarball_task = tarball_task;
|
||||
|
||||
task_queue->enqueue(
|
||||
job_statuses->at("tarball"),
|
||||
[this, r](std::shared_ptr<Log> log) mutable {
|
||||
create_project_tarball(r, log);
|
||||
},
|
||||
r
|
||||
);
|
||||
new_item->first_tarball_task = r->get_task_by_jobstatus(job_statuses->at("tarball"));
|
||||
|
||||
new_item->first_pkgconf = r;
|
||||
|
||||
new_item->packaging_commit = r->packaging_commit;
|
||||
|
@ -95,17 +95,22 @@ void TaskQueue::worker_thread() {
|
||||
bool found_valid = false;
|
||||
// Iterate through the set until a valid task is found
|
||||
while (it != tasks_.end()) {
|
||||
std::shared_ptr<Task> it_task = *it;
|
||||
task_to_execute = it_task;
|
||||
{
|
||||
std::shared_ptr<Task> it_task = *it;
|
||||
task_to_execute = it_task;
|
||||
}
|
||||
|
||||
int pkgconf_id = task_to_execute->get_parent_packageconf()->id;
|
||||
|
||||
std::lock_guard<std::mutex> lock(running_pkgconfs_mutex_);
|
||||
auto running_pkgconf_it = std::find_if(running_pkgconfs_.begin(), running_pkgconfs_.end(),
|
||||
[&pkgconf_id](const std::shared_ptr<PackageConf>& pkgconf) { return pkgconf->id == pkgconf_id; });
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(running_pkgconfs_mutex_);
|
||||
auto running_pkgconf_it = std::find_if(running_pkgconfs_.begin(), running_pkgconfs_.end(),
|
||||
[&pkgconf_id](const std::shared_ptr<PackageConf>& pkgconf) { return pkgconf->id == pkgconf_id; });
|
||||
|
||||
if (running_pkgconf_it != running_pkgconfs_.end()) {
|
||||
++it; // Move to the next task
|
||||
continue;
|
||||
if (running_pkgconf_it != running_pkgconfs_.end()) {
|
||||
++it; // Move to the next task
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Task is valid to execute
|
||||
|
Loading…
x
Reference in New Issue
Block a user