Queue dispatch logs more stats. May be too noisy...
This commit is contained in:
parent
1438b7cee8
commit
88d9c29442
@ -350,14 +350,26 @@ sub deliver_queue {
|
|||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $try_failed = shift;
|
my $try_failed = shift;
|
||||||
|
|
||||||
|
$self -> {"logger"} -> log("messaging", 0, undef, "Starting queue delivery");
|
||||||
|
|
||||||
|
# Keep some counters...
|
||||||
|
my $counts = { "transports" => 0,
|
||||||
|
"messages" => 0,
|
||||||
|
"success" => 0,
|
||||||
|
};
|
||||||
|
|
||||||
# Go through the list of transports, fetching the messages that can be sent by
|
# Go through the list of transports, fetching the messages that can be sent by
|
||||||
# that transport and try to send them.
|
# that transport and try to send them.
|
||||||
my $transports = $self -> get_transports();
|
my $transports = $self -> get_transports();
|
||||||
foreach my $transport (@{$transports}) {
|
foreach my $transport (@{$transports}) {
|
||||||
|
++$counts -> {"transports"};
|
||||||
|
|
||||||
my $messages = $self -> get_sendable_messages($transport -> {"id"}, $try_failed)
|
my $messages = $self -> get_sendable_messages($transport -> {"id"}, $try_failed)
|
||||||
or return undef;
|
or return undef;
|
||||||
|
|
||||||
if(scalar(@{$messages})) {
|
if(scalar(@{$messages})) {
|
||||||
|
$counts -> {"messages"} += scalar(@{$messages});
|
||||||
|
|
||||||
# Load the transport...
|
# Load the transport...
|
||||||
$transport -> {"module"} = $self -> load_transport_module(id => $transport -> {"id"})
|
$transport -> {"module"} = $self -> load_transport_module(id => $transport -> {"id"})
|
||||||
or return $self -> self_error("Transport loading failed: ".$self -> {"errstr"});
|
or return $self -> self_error("Transport loading failed: ".$self -> {"errstr"});
|
||||||
@ -366,6 +378,8 @@ sub deliver_queue {
|
|||||||
foreach my $message (@{$messages}) {
|
foreach my $message (@{$messages}) {
|
||||||
my $sent = $transport -> {"module"} -> deliver($message);
|
my $sent = $transport -> {"module"} -> deliver($message);
|
||||||
|
|
||||||
|
++$counts -> {"success"} if($sent);
|
||||||
|
|
||||||
# Store the send status for this transport
|
# Store the send status for this transport
|
||||||
$self -> update_status($message -> {"id"},
|
$self -> update_status($message -> {"id"},
|
||||||
$transport -> {"id"},
|
$transport -> {"id"},
|
||||||
@ -375,6 +389,7 @@ sub deliver_queue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$self -> {"logger"} -> log("messaging", 0, undef, "Queue delivery finished, processed ".$counts -> {"messages"}." through ".$counts -> {"transports"}.". ".$counts -> {"success"}." messages sent, ".($counts -> {"messages"} - $counts -> {"success"})." failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user