=cut
+# Track remote-id's / addresses for clients which sent us a request, but
+# are no longer connected to the message bus. In cases where a client
+# goes away during an API call that produces many responses, the "not
+# connected" error logs below will repeat per response, which could be
+# quite a bit of repititive logging.
+#
+# We could track this as session-level information instead, but the
+# assumption is that this list will not grow large unless your system is
+# already unusable.
+my %lost_callers;
+
sub handler {
my $start_time = time();
my( $class, $service, $data ) = @_;
$logger->set_osrf_xid($data->osrf_xid);
+ if (defined($type) and $type eq 'error') {
+ if ($lost_callers{$remote_id}) {
+ # We've already raised an exception and logged a warning about
+ # this caller disappearing.
+ return 0;
+ }
- if (defined($type) and $type eq 'error') {
- throw OpenSRF::EX::Session ("$remote_id IS NOT CONNECTED TO THE NETWORK!!!");
-
- }
+ $lost_callers{$remote_id} = 1;
+ throw OpenSRF::EX::Session ("$remote_id IS NOT CONNECTED TO THE NETWORK!!!");
+ }
# See if the app_session already exists. If so, make
# sure the sender hasn't changed if we're a server