Non-intensive modules do not need to check a timestamp.
Ref pandora_enterprise#4660.
This commit is contained in:
parent
76d9ca9db5
commit
337e3357db
|
@ -1708,3 +1708,17 @@ void
|
||||||
Pandora_Module::setExecutions (long executions) {
|
Pandora_Module::setExecutions (long executions) {
|
||||||
this->executions = 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;
|
||||||
|
}
|
||||||
|
|
|
@ -303,6 +303,7 @@ namespace Pandora_Modules {
|
||||||
time_t getTimestamp ();
|
time_t getTimestamp ();
|
||||||
void setIntensiveMatch (unsigned char intensive_match);
|
void setIntensiveMatch (unsigned char intensive_match);
|
||||||
unsigned char getIntensiveMatch ();
|
unsigned char getIntensiveMatch ();
|
||||||
|
bool isIntensive ();
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1918,16 +1918,19 @@ Pandora_Windows_Service::pandora_run_broker (string config, long executions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Evaluate intensive conditions */
|
/* Evaluate intensive conditions */
|
||||||
intensive_match = module->evaluateIntensiveConditions ();
|
if (module->isIntensive()) {
|
||||||
if (intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) {
|
intensive_match = module->evaluateIntensiveConditions ();
|
||||||
module->setNoOutput ();
|
if (intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) {
|
||||||
this->broker_modules->goNext ();
|
module->setNoOutput ();
|
||||||
continue;
|
this->broker_modules->goNext ();
|
||||||
}
|
continue;
|
||||||
module->setIntensiveMatch (intensive_match);
|
}
|
||||||
|
|
||||||
if (module->getTimestamp () + module->getInterval () * this->interval_sec <= this->run_time) {
|
if (module->getTimestamp () + module->getInterval () * this->interval_sec <= this->run_time) {
|
||||||
module->setTimestamp (this->run_time);
|
module->setTimestamp (this->run_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
module->setIntensiveMatch (intensive_match);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Evaluate module conditions */
|
/* Evaluate module conditions */
|
||||||
|
@ -2038,16 +2041,19 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Evaluate intensive conditions */
|
/* Evaluate intensive conditions */
|
||||||
intensive_match = module->evaluateIntensiveConditions ();
|
if (module->isIntensive()) {
|
||||||
if (forced_run != 1 && intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) {
|
intensive_match = module->evaluateIntensiveConditions ();
|
||||||
module->setNoOutput ();
|
if (forced_run != 1 && intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) {
|
||||||
this->modules->goNext ();
|
module->setNoOutput ();
|
||||||
continue;
|
this->modules->goNext ();
|
||||||
}
|
continue;
|
||||||
module->setIntensiveMatch (intensive_match);
|
}
|
||||||
|
|
||||||
if (module->getTimestamp () + module->getInterval () * this->interval_sec <= this->run_time) {
|
if (module->getTimestamp () + module->getInterval () * this->interval_sec <= this->run_time) {
|
||||||
module->setTimestamp (this->run_time);
|
module->setTimestamp (this->run_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
module->setIntensiveMatch (intensive_match);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Evaluate module conditions */
|
/* Evaluate module conditions */
|
||||||
|
|
Loading…
Reference in New Issue