LP#1729610: Add some debug/internal logging to backlog queue
authorMike Rylander <mrylander@gmail.com>
Tue, 24 Oct 2017 20:45:09 +0000 (16:45 -0400)
committerMike Rylander <mrylander@gmail.com>
Fri, 4 Jan 2019 19:06:37 +0000 (14:06 -0500)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
src/perl/lib/OpenSRF/Server.pm

index 0eaac40..0d31fcf 100644 (file)
@@ -169,6 +169,9 @@ sub run {
         $from_network = $wait_time = -1 if (!$msg);
         $msg ||= $self->{osrf_handle}->process($wait_time);
 
         $from_network = $wait_time = -1 if (!$msg);
         $msg ||= $self->{osrf_handle}->process($wait_time);
 
+        !$from_network and $chatty and $logger->debug("server: attempting to process previously queued message");
+        $from_network and $chatty and $logger->internal("server: no queued messages, processing due to network or signal");
+
         # we woke up for any reason, reset the wait time to allow
         # for idle maintenance as necessary
         $wait_time = 1;
         # we woke up for any reason, reset the wait time to allow
         # for idle maintenance as necessary
         $wait_time = 1;
@@ -198,11 +201,15 @@ sub run {
                     "in the OpenSRF configuration if this message occurs frequently");
 
                 if ($from_network) {
                     "in the OpenSRF configuration if this message occurs frequently");
 
                 if ($from_network) {
+                    $chatty and $logger->debug("server: queuing new message");
                     push @max_children_msg_queue, $msg;
                 } else {
                     push @max_children_msg_queue, $msg;
                 } else {
+                    $chatty and $logger->debug("server: re-queuing old message");
                     unshift @max_children_msg_queue, $msg;
                 }
 
                     unshift @max_children_msg_queue, $msg;
                 }
 
+                $logger->warn("server: backlog queue size is now ". scalar(@max_children_msg_queue));
+
                 if (@max_children_msg_queue < $self->{max_backlog_queue}) {
                     # We still have room on the queue. Set the wait time to
                     # 1s, waiting for a drone to be freed up and reprocess
                 if (@max_children_msg_queue < $self->{max_backlog_queue}) {
                     # We still have room on the queue. Set the wait time to
                     # 1s, waiting for a drone to be freed up and reprocess