in src/oomd/engine/Ruleset.cpp [169:224]
int Ruleset::run_action_chain(
std::vector<std::unique_ptr<BasePlugin>>::iterator action_chain_start,
std::vector<std::unique_ptr<BasePlugin>>::iterator action_chain_end,
OomdContext& context) {
for (; action_chain_start != action_chain_end; ++action_chain_start) {
const std::unique_ptr<BasePlugin>& action = *action_chain_start;
if (!(silenced_logs_ & LogSources::ENGINE)) {
OLOG << "Running Action=" << action->getName();
}
if (silenced_logs_ & LogSources::PLUGINS) {
OLOG << LogStream::Control::DISABLE;
}
PluginRet ret = action->run(context);
if (silenced_logs_ & LogSources::PLUGINS) {
OLOG << LogStream::Control::ENABLE;
}
switch (ret) {
case PluginRet::CONTINUE:
if (!(silenced_logs_ & LogSources::ENGINE)) {
OLOG << "Action=" << action->getName()
<< " returned CONTINUE. Continuing action chain.";
}
continue;
case PluginRet::STOP:
if (!(silenced_logs_ & LogSources::ENGINE)) {
OLOG << "Action=" << action->getName()
<< " returned STOP. Terminating action chain.";
}
if (!plugin_overrode_post_action_delay_) {
pause_actions_until_ = std::chrono::steady_clock::now() +
std::chrono::seconds(post_action_delay_);
}
plugin_overrode_post_action_delay_ = false;
break; // break out of switch
case PluginRet::ASYNC_PAUSED:
active_action_chain_state_ = std::make_optional(AsyncActionChainState{
.active_plugin = std::ref(*action.get()),
.action_context = context.getActionContext()});
OLOG << "Action=" << action->getName()
<< " returned ASYNC. Yielding action chain.";
return 0; // don't return 1 until action returns STOP
// missing default to protect against future PluginRet vals
}
break;
}
return 1;
}