Merge branch 'ent-4660-problema-con-agentes-windows-en-envio-xml' into 'develop'

Non-intensive modules do not need to check a timestamp.

See merge request artica/pandorafms!2911
This commit is contained in:
Alejandro Fraguas 2019-11-26 10:59:12 +01:00
commit 2deee86f53
3 changed files with 41 additions and 20 deletions

View File

@ -1708,3 +1708,17 @@ void
Pandora_Module::setExecutions (long executions) {
this->executions = executions;
}
/**
* Checks if the module has intensive conditions.
*
* @return true if the module's intensive condition list is not empty, false if it is.
*/
bool
Pandora_Module::isIntensive () {
if (this->intensive_condition_list == NULL || this->intensive_condition_list->size () <= 0) {
return false;
}
return true;
}

View File

@ -303,6 +303,7 @@ namespace Pandora_Modules {
time_t getTimestamp ();
void setIntensiveMatch (unsigned char intensive_match);
unsigned char getIntensiveMatch ();
bool isIntensive ();
};
}

View File

@ -1918,16 +1918,19 @@ Pandora_Windows_Service::pandora_run_broker (string config, long executions) {
}
/* Evaluate intensive conditions */
intensive_match = module->evaluateIntensiveConditions ();
if (intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) {
module->setNoOutput ();
this->broker_modules->goNext ();
continue;
}
module->setIntensiveMatch (intensive_match);
if (module->getTimestamp () + module->getInterval () * this->interval_sec <= this->run_time) {
module->setTimestamp (this->run_time);
if (module->isIntensive()) {
intensive_match = module->evaluateIntensiveConditions ();
if (intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) {
module->setNoOutput ();
this->broker_modules->goNext ();
continue;
}
if (module->getTimestamp () + module->getInterval () * this->interval_sec <= this->run_time) {
module->setTimestamp (this->run_time);
}
module->setIntensiveMatch (intensive_match);
}
/* Evaluate module conditions */
@ -2038,16 +2041,19 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
}
/* Evaluate intensive conditions */
intensive_match = module->evaluateIntensiveConditions ();
if (forced_run != 1 && intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) {
module->setNoOutput ();
this->modules->goNext ();
continue;
}
module->setIntensiveMatch (intensive_match);
if (module->getTimestamp () + module->getInterval () * this->interval_sec <= this->run_time) {
module->setTimestamp (this->run_time);
if (module->isIntensive()) {
intensive_match = module->evaluateIntensiveConditions ();
if (forced_run != 1 && intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) {
module->setNoOutput ();
this->modules->goNext ();
continue;
}
if (module->getTimestamp () + module->getInterval () * this->interval_sec <= this->run_time) {
module->setTimestamp (this->run_time);
}
module->setIntensiveMatch (intensive_match);
}
/* Evaluate module conditions */