Remove upq from ConfigItem::ActivateItems

Since commit d9010c7b9f, ActivateItems no
longer uses the WorkQueue upq to perform tasks but instead performs
these locally. One instance of `upq.Join()`/`upq.HasExceptions()`
remained in the function, but I believe this was just missed when
removing the `upq.Enqueue()` call just before.

This commit removes the corresponding parameter and updates all call
sites accordingly.
This commit is contained in:
Julian Brost 2021-01-13 15:19:55 +01:00
parent 5f548c8f89
commit 0c6abc817b
4 changed files with 5 additions and 15 deletions

View File

@ -275,11 +275,8 @@ int RunWorker(const std::vector<std::string>& configs, bool closeConsoleLog = fa
return EXIT_FAILURE;
}
WorkQueue upq(25000, Configuration::Concurrency);
upq.SetName("DaemonCommand::Run");
// activate config only after daemonization: it starts threads and that is not compatible with fork()
if (!ConfigItem::ActivateItems(upq, newItems, false, false, true)) {
if (!ConfigItem::ActivateItems(newItems, false, false, true)) {
Log(LogCritical, "cli", "Error activating configuration.");
return EXIT_FAILURE;
}

View File

@ -624,7 +624,7 @@ bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& u
return true;
}
bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr>& newItems, bool runtimeCreated,
bool ConfigItem::ActivateItems(const std::vector<ConfigItem::Ptr>& newItems, bool runtimeCreated,
bool silent, bool withModAttrs, const Value& cookie)
{
static boost::mutex mtx;
@ -697,13 +697,6 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr
}
}
upq.Join();
if (upq.HasExceptions()) {
upq.ReportExceptions("ConfigItem");
return false;
}
#ifdef I2_DEBUG
for (const ConfigItem::Ptr& item : newItems) {
ConfigObject::Ptr object = item->m_Object;
@ -738,7 +731,7 @@ bool ConfigItem::RunWithActivationContext(const Function::Ptr& function)
if (!CommitItems(scope.GetContext(), upq, newItems, true))
return false;
if (!ActivateItems(upq, newItems, false, true))
if (!ActivateItems(newItems, false, true))
return false;
return true;

View File

@ -53,7 +53,7 @@ public:
const String& name);
static bool CommitItems(const ActivationContext::Ptr& context, WorkQueue& upq, std::vector<ConfigItem::Ptr>& newItems, bool silent = false);
static bool ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr>& newItems, bool runtimeCreated = false,
static bool ActivateItems(const std::vector<ConfigItem::Ptr>& newItems, bool runtimeCreated = false,
bool silent = false, bool withModAttrs = false, const Value& cookie = Empty);
static bool RunWithActivationContext(const Function::Ptr& function);

View File

@ -217,7 +217,7 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full
* uq, items, runtimeCreated, silent, withModAttrs, cookie
* IMPORTANT: Forward the cookie aka origin in order to prevent sync loops in the same zone!
*/
if (!ConfigItem::ActivateItems(upq, newItems, true, true, false, cookie)) {
if (!ConfigItem::ActivateItems(newItems, true, true, false, cookie)) {
if (errors) {
Log(LogNotice, "ConfigObjectUtility")
<< "Failed to activate config object '" << fullName << "'. Aborting and removing config path '" << path << "'.";