Ignore out of order data instead of resetting the module.
This commit is contained in:
parent
0a0d9fad25
commit
06e715b6db
|
@ -3525,20 +3525,25 @@ sub process_inc_data ($$$$$) {
|
|||
return undef;
|
||||
}
|
||||
|
||||
# Negative increment, reset inc data
|
||||
if ($data < $data_inc->{'datos'} || $utimestamp < $data_inc->{'utimestamp'}) {
|
||||
db_do ($dbh, 'UPDATE tagente_datos_inc SET datos = ?, utimestamp = ? WHERE id_agente_modulo = ?', $data, $utimestamp, $module->{'id_agente_modulo'});
|
||||
logger($pa_config, "Discarding data and resetting counter for incremental module " . $module->{'nombre'} . "(module id " . $module->{'id_agente_modulo'} . ").", 10);
|
||||
|
||||
# Prevent the module from becoming unknown!
|
||||
db_do ($dbh, 'UPDATE tagente_estado SET utimestamp = ? WHERE id_agente_modulo = ?', time(), $module->{'id_agente_modulo'});
|
||||
|
||||
# Out of order data
|
||||
if ($utimestamp < $data_inc->{'utimestamp'}) {
|
||||
logger($pa_config, "Received old data for incremental module " . $module->{'nombre'} . "(module id " . $module->{'id_agente_modulo'} . ").", 3);
|
||||
return undef;
|
||||
}
|
||||
|
||||
# Should not happen
|
||||
if ($utimestamp == $data_inc->{'utimestamp'}) {
|
||||
logger($pa_config, "Duplicate timestamp for incremental module " . $module->{'nombre'} . "(module id " . $module->{'id_agente_modulo'} . ").", 10);
|
||||
logger($pa_config, "Duplicate timestamp for incremental module " . $module->{'nombre'} . "(module id " . $module->{'id_agente_modulo'} . ").", 3);
|
||||
return undef;
|
||||
}
|
||||
|
||||
# Negative increment, reset inc data
|
||||
if ($data < $data_inc->{'datos'}) {
|
||||
db_do ($dbh, 'UPDATE tagente_datos_inc SET datos = ?, utimestamp = ? WHERE id_agente_modulo = ?', $data, $utimestamp, $module->{'id_agente_modulo'});
|
||||
logger($pa_config, "Discarding data and resetting counter for incremental module " . $module->{'nombre'} . "(module id " . $module->{'id_agente_modulo'} . ").", 10);
|
||||
|
||||
# Prevent the module from becoming unknown!
|
||||
db_do ($dbh, 'UPDATE tagente_estado SET utimestamp = ? WHERE id_agente_modulo = ?', time(), $module->{'id_agente_modulo'});
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue