From: Dirk Koopman Date: Wed, 3 Jun 2020 22:38:27 +0000 (+0100) Subject: fix log and sh/dx ordering issues. X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=8c339125008c925eefda7c815ccabac9c577ae3f;p=spider.git fix log and sh/dx ordering issues. --- diff --git a/Changes b/Changes index 522eb779..e06371d6 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ 03Jun20======================================================================= 1. Make sure that all possible regexes get passed across to the search engine. +2. Fix out of order logging on sh/log queries spanning more than one month. +3. Do not read backwards on sh/dx, reading forwards seems a 1/3 quicker. 02Jun20======================================================================= 1. Fix the small whoopsie in sh/dx. 01Jun20======================================================================= diff --git a/perl/DXLogPrint.pm b/perl/DXLogPrint.pm index 9bb51f20..0d99eb41 100644 --- a/perl/DXLogPrint.pm +++ b/perl/DXLogPrint.pm @@ -18,9 +18,12 @@ use DXLog; use Julian; -our $readback = `which tac`; +our $readback = 1; +if ($readback) { + $readback = `which tac`; +} chomp $readback; -undef $readback; # yet another reason not to use the cloud! +#undef $readback; # yet another reason not to use the cloud! use strict; @@ -109,7 +112,7 @@ sub print return "show/$name: ${s}not found"; } - for (reverse @in) { + for (sort {$a <=> $b } @in) { my @line = split /\^/ ; push @out, print_item(\@line); diff --git a/perl/Spot.pm b/perl/Spot.pm index 185711b5..3d671d76 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -63,10 +63,9 @@ $filterdef = bless ([ $totalspots = $hfspots = $vhfspots = 0; $use_db_for_search = 0; -our $usetac = 1; -our $readback; +our $readback = 0; -if ($usetac) { +if ($readback) { $readback = `which tac`; chomp $readback; } @@ -293,7 +292,7 @@ sub search return $main::dbh->spot_search($hint, $dayfrom, $dayto, $to-$from, $dxchan); } -# $expr =~ s/\$f(\d\d?)/\$ref->[$1]/g; # swap the letter n for the correct field name + # $expr =~ s/\$f(\d\d?)/\$ref->[$1]/g; # swap the letter n for the correct field name # $expr =~ s/\$f(\d)/\$spots[$1]/g; # swap the letter n for the correct field name @@ -313,16 +312,17 @@ sub search my @spots; my $recs; - for ($i = $count = 0; $count < $to && $i < $maxdays; ++$i) { # look thru $maxdays worth of files only + for ($i = $count = 0; $count < $to && $i < $maxdays; ++$i) { # look thru $maxdays worth of files only last if $now->cmp($todate) <= 0; my $fn = $fp->fn($now->sub($i)); if ($readback) { dbg("Spot::search search using tac fn: $fn $i") if isdbg('search'); $fh = IO::File->new("$readback $fn |"); - } else { + } + else { dbg("Spot::search search fn: $fp->{fn} $i") if isdbg('search'); - $fh = $fp->open($now->sub($i)); # get the next file + $fh = $fp->open($now->sub($i)); # get the next file } if ($fh) { my $rec = 0; @@ -343,9 +343,8 @@ sub search return ("Spot search error", $@) if $@; } } - - - return $readback ? @out : reverse @out; + @out = sort {$b->[2] <=> $a->[2]} @out if @out; + return @out; } # change a freq range->regular expression