Catch spot dupes if they come in very quickly
[spider.git] / perl / Spot.pm
index 2adce5429b0cc4b02c86c950a79eb4310a087c77..64db9a722498109f10edcda7a5470ba2f05577b8 100644 (file)
@@ -74,7 +74,7 @@ our $spotcachedays = 2;                       # default 2 days worth
 our $minselfspotqrg = 1240000; # minimum freq above which self spotting is allowed
 
 our $readback = $main::is_win ? 0 : 1; # don't read spot files backwards if it's windows
-our $qrggranularity = 100000;  # normalise the qrg to this number of hz (default: 100khz), so tough luck if you have a fumble fingers moment
+our $qrggranularity = 1000;    # normalise the qrg to this number of hz (default: 100khz), so tough luck if you have a fumble fingers moment
 our $timegranularity = 600;            # ditto to the nearest 100 seconds 
 our $oldstyle = 0;                             # revert to traditional dupe key format
 
@@ -193,7 +193,6 @@ sub init
        if ($spotcachedays > 0) {
                my $t0 = [gettimeofday];
                $spotcachedays = 2 if $spotcachedays < 2;
-               dbg "Spot::init - reading in $spotcachedays days of spots into cache"; 
                for (my $i = 0; $i < $spotcachedays; ++$i) {
                        my $now = $today->sub($i);
                        my $fh = $fp->open($now);
@@ -515,10 +514,9 @@ sub dup
        $text = substr($text, 0, $duplth) if length $text > $duplth; 
        my $ldupkey = $oldstyle ? "X|$call|$by|$node|$freq|$d|$text" : "X|$call|$by|$node|$qrg|$nd|$text";
 
-       dbg("Spot::dup ldupkey $ldupkey") if isdbg('spotdup');
-       
        my $t = DXDupe::find($ldupkey);
-       return 1 if $t && $t - $main::systime > 0;
+       dbg("Spot::dup ldupkey $ldupkey t '$t'") if isdbg('spotdup');
+       return 1 if $t > 0;
        
        DXDupe::add($ldupkey, $main::systime+$dupage) unless $just_find;
        $otext = substr($otext, 0, $duplth) if length $otext > $duplth; 
@@ -526,7 +524,8 @@ sub dup
        if (length $otext && $otext ne $text) {
                $ldupkey = $oldstyle ? "X|$freq|$call|$by|$otext" : "X|$qrg|$call|$by|$otext";
                $t = DXDupe::find($ldupkey);
-               return 1 if $t && $t - $main::systime > 0;
+               dbg("Spot::dup ldupkey $ldupkey t '$t'") if isdbg('spotdup');
+               return 1 if $t > 0;
                DXDupe::add($ldupkey, $main::systime+$dupage) unless $just_find;
        }
        return undef;