added option to discard streaming results
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 11 Mar 2010 23:38:31 +0000 (23:38 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 11 Mar 2010 23:38:31 +0000 (23:38 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15812 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm

index 11a5e75..66345b0 100644 (file)
@@ -361,7 +361,7 @@ sub request {
             $self->log(D,"running in substream mode");
             $val = [];
             while( my $resp = $req->recv(timeout => $self->timeout) ) {
-                push(@$val, $resp->content) if $resp->content;
+                push(@$val, $resp->content) if $resp->content and not $self->discard;
             }
 
         } else {
@@ -391,6 +391,16 @@ sub substream {
    return $self->{substream};
 }
 
+# -----------------------------------------------------------------------------
+# discard response data instead of returning it to the caller.  currently only 
+# works in conjunction with substream mode.  
+# -----------------------------------------------------------------------------
+sub discard {
+   my( $self, $bool ) = @_;
+   $self->{discard} = $bool if defined $bool;
+   return $self->{discard};
+}
+
 
 # -----------------------------------------------------------------------------
 # Sets / Returns the requestor object.  This is set when checkauth succeeds.
@@ -661,6 +671,7 @@ sub runmethod {
 
     $method =~ s/\.atomic$//o if $self->substream($$options{substream} || 0);
     $self->timeout($$options{timeout});
+    $self->discard($$options{discard});
 
        # remove any stale events
        $self->clear_event;
@@ -791,6 +802,7 @@ sub json_query {
     $method =~ s/\.atomic$//o if $self->substream($$options{substream} || 0);
 
     $self->timeout($$options{timeout});
+    $self->discard($$options{discard});
        $self->clear_event;
     my $obj;
     my $err;