From: Darold Gilles Date: Thu, 20 Jun 2013 17:24:33 +0000 (+0200) Subject: Remove creation of incremental temporary file $tmp_last_parsed when we are not in... X-Git-Tag: v3.5~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=74735c39a1c764bc11d4c870884df00aff091f75;p=pgbadger Remove creation of incremental temporary file $tmp_last_parsed when we are not in multiprocess mode. Thanks to Herve Werner for the report. --- diff --git a/pgbadger b/pgbadger index 45cd66d..b5fee24 100755 --- a/pgbadger +++ b/pgbadger @@ -1464,13 +1464,15 @@ sub process_file } # Save last line into temporary file - if ($last_parsed && scalar keys %last_line) { - if (open(OUT, ">>$tmp_last_parsed")) { - flock(OUT, 2) || return $getout; - print OUT "$last_line{datetime}\t$last_line{orig}\n"; - close(OUT); - } else { - &logmsg('ERROR', "can't save last parsed line into $last_parsed, $!"); + if ( ($queue_size > 1) || ($job_per_file > 1) ) { + if ($last_parsed && scalar keys %last_line) { + if (open(OUT, ">>$tmp_last_parsed")) { + flock(OUT, 2) || return $getout; + print OUT "$last_line{datetime}\t$last_line{orig}\n"; + close(OUT); + } else { + &logmsg('ERROR', "can't save last parsed line into $tmp_last_parsed, $!"); + } } }