Skip to content

Commit

Permalink
Merge pull request #10162 from Icinga/unregister-invalid-objects-prop…
Browse files Browse the repository at this point in the history
…erly-2.14

Unregister invalid config objects properly
  • Loading branch information
yhabteab committed Sep 20, 2024
2 parents d94aa87 + eeaa25c commit 2d9917a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/config/configitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,13 +478,16 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
continue;

std::atomic<int> committed_items(0);
std::mutex newItemsMutex;

{
auto items (itemsByType.find(type.get()));

if (items != itemsByType.end()) {
upq.ParallelFor(items->second, [&committed_items, &newItems, &newItemsMutex](const ItemPair& ip) {
for (const ItemPair& pair: items->second) {
newItems.emplace_back(pair.first);
}

upq.ParallelFor(items->second, [&committed_items](const ItemPair& ip) {
const ConfigItem::Ptr& item = ip.first;

if (!item->Commit(ip.second)) {
Expand All @@ -496,9 +499,6 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
}

committed_items++;

std::unique_lock<std::mutex> lock(newItemsMutex);
newItems.emplace_back(item);
});

upq.Join();
Expand Down

0 comments on commit 2d9917a

Please sign in to comment.