silently skip empty chunks
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 7 Dec 2010 18:36:59 +0000 (19:36 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 7 Dec 2010 18:36:59 +0000 (19:36 +0100)
couchdb-trigger.pl

index 873beee..77fa41c 100755 (executable)
@@ -46,12 +46,9 @@ while( ! $error ) {
        $tx->res->body(sub{
                my ( $content, $body ) = @_;
 
-               debug 'BODY' => $body;
+               return if length($body) == 0; # empty chunk, heartbeat?
 
-               if ( length($body) == 0 ) {
-                       warn "# empty chunk, heartbeat?\n";
-                       return;
-               }
+               debug 'BODY' => $body;
 
                foreach ( split(/\r?\n/, $body) ) { # we can get multiple documents in one chunk