From ece7705b3b75b26c2b4e72aaec5edb07e72de56b Mon Sep 17 00:00:00 2001 From: Cristian Herghelegiu Date: Sat, 4 Jan 2025 20:39:45 +0200 Subject: [PATCH] Refactor jobs engine into multiple files --- include/jobs_engine.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/include/jobs_engine.h b/include/jobs_engine.h index 06084fa..9fb17b0 100644 --- a/include/jobs_engine.h +++ b/include/jobs_engine.h @@ -293,14 +293,15 @@ namespace small { *has_items = true; - // get jobs - std::vector> jobs_items = m_queue.jobs_get(vec_ids); - // split by type std::unordered_map>> elems_by_type; - for (auto &jobs_item : jobs_items) { - elems_by_type[jobs_item->type].reserve(jobs_items.size()); - elems_by_type[jobs_item->type].push_back(jobs_item); + { + // get jobs + std::vector> jobs_items = m_queue.jobs_get(vec_ids); + for (auto &jobs_item : jobs_items) { + elems_by_type[jobs_item->type].reserve(jobs_items.size()); + elems_by_type[jobs_item->type].push_back(jobs_item); + } } // process specific job by type @@ -311,9 +312,7 @@ namespace small { } // process specific jobs by type - if (it_cfg_type->second.m_processing_function) { - it_cfg_type->second.m_processing_function(std::move(jobs)); - } + it_cfg_type->second.m_processing_function(jobs); } for (auto &jobs_id : vec_ids) {