From 97001740e25dd8280fb68915cde2332d2be3f2ca Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 13 Feb 2021 12:52:54 +0100 Subject: [PATCH] Do enable staging in the current batch when processing the very first package Likely not really relevant because the function should only be called when processing the 2nd or further packages. However, this way it seems a little bit less error prone. --- librepomgr/buildactions/buildactionprivate.h | 2 +- librepomgr/buildactions/conductbuild.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/librepomgr/buildactions/buildactionprivate.h b/librepomgr/buildactions/buildactionprivate.h index b016353..aa79612 100644 --- a/librepomgr/buildactions/buildactionprivate.h +++ b/librepomgr/buildactions/buildactionprivate.h @@ -510,7 +510,7 @@ struct LIBREPOMGR_EXPORT BatchProcessingSession : public MultiSession &m_relevantPackages; std::mutex m_mutex; - std::vector>::iterator m_batchIterator, m_batchEnd; + std::vector>::iterator m_batchBegin, m_batchIterator, m_batchEnd; std::vector::iterator m_packageIterator, m_packageEnd; bool m_skipBatchesAfterFailure; bool m_hasFailuresInPreviousBatches; diff --git a/librepomgr/buildactions/conductbuild.cpp b/librepomgr/buildactions/conductbuild.cpp index a285a78..9e074e8 100644 --- a/librepomgr/buildactions/conductbuild.cpp +++ b/librepomgr/buildactions/conductbuild.cpp @@ -75,6 +75,7 @@ BatchProcessingSession::BatchProcessingSession(const std::unordered_set(ioContext, std::move(handler)) , m_relevantPackages(relevantPackages) + , m_batchBegin(batches.begin()) , m_batchIterator(batches.begin()) , m_batchEnd(batches.end()) , m_packageIterator(m_batchIterator != m_batchEnd ? m_batchIterator->begin() : decltype(m_packageIterator)()) @@ -168,7 +169,7 @@ const std::string *BatchProcessingSession::getCurrentPackageNameIfValidAndReleva /*! * \brief * Enables staging for the next batch. Enables staging for the current batch if the current package is the first package of - * current batch. + * current batch and the current batch is not the first batch. * \remarks * - The behavior regarding the current batch was chosen because we call selectNextPackage() *before* enableStagingInNextBatch(). * - This function might be called from multiple threads at the same time. @@ -178,7 +179,7 @@ void BatchProcessingSession::enableStagingInNextBatch() m_enableStagingInNextBatch = true; if (!m_stagingEnabled) { std::lock_guard lock(m_mutex); - m_stagingEnabled = m_batchIterator != m_batchEnd && m_packageIterator == m_batchIterator->begin(); + m_stagingEnabled = m_batchIterator != m_batchEnd && m_batchIterator != m_batchBegin && m_packageIterator == m_batchIterator->begin(); } }