Fix get agent status for agent with only noninit modules

This commit is contained in:
Calvo 2023-08-29 15:42:15 +02:00
parent 36d8f3c15a
commit 4954f761d6
1 changed files with 2 additions and 2 deletions

View File

@ -686,9 +686,9 @@ sub get_agent_status ($$$) {
if ($modules_async < $count_modules) {
my $last_contact = get_db_value($dbh,
'SELECT (UNIX_TIMESTAMP(ultimo_contacto) + (intervalo * 2)) AS last_contact
FROM tagente WHERE id_agente = ?', $agent_id);
FROM tagente WHERE id_agente = ? AND UNIX_TIMESTAMP(ultimo_contacto) > 0', $agent_id);
if ($last_contact < time ()) {
if (defined($last_contact) && $last_contact < time ()) {
return 3;
}
}