trace if failed to encode json (summary)

This commit is contained in:
fbsanchez 2020-04-28 12:19:46 +02:00
parent 744bac6736
commit 3ad1b5f2e3
1 changed files with 6 additions and 2 deletions

View File

@ -1694,12 +1694,16 @@ sub PandoraFMS::Recon::Base::update_progress ($$) {
$stats->{'c_network_name'} = $self->{'c_network_name'};
$stats->{'c_network_percent'} = $self->{'c_network_percent'};
my %t = %{$stats};
# Store progress, last contact and overall status.
db_do ($self->{'dbh'}, 'UPDATE trecon_task SET utimestamp = ?, status = ?, summary = ? WHERE id_rt = ?',
time (), $progress, encode_json($stats), $self->{'task_id'});
time (), $progress, encode_json(\%t), $self->{'task_id'});
};
if ($@) {
$self->call('Message', "Problems updating progress $@");
$self->call('message', "Problems updating progress $@", 5);
db_do ($self->{'dbh'}, 'UPDATE trecon_task SET utimestamp = ?, status = ?, summary = ? WHERE id_rt = ?',
time (), $progress, "{}", $self->{'task_id'});
}
}