+ # add me to the display queue unless we are waiting for initial in rush to finish
+ return unless $self->{inrushpreventor} < $main::systime;
+ push @{$self->{queue}}, $sp if @$spot == 1; # queue the KEY (not the record)
+
+ # build up a new record and store it in the buildup
+ # deal with the unix time
+ my ($hh,$mm) = $t =~ /(\d\d)(\d\d)Z$/;
+ my $utz = $hh*3600 + $mm*60 + $main::systime_daystart; # possible issue with late spot from previous day
+ $utz -= 86400 if $utz > $tim+3600; # too far ahead, drag it back one day
+
+ # create record and add into the buildup
+ my $r = [$origin, nearest(.1, $qrg), $call, $mode, $s, $t, $utz, $respot, $u];
+ dbg("RBN: key: '$sp' ADD RECORD call: $call qrg: $qrg origin: $origin") if isdbg('rbn');
+ my @s = Spot::prepare($r->[1], $r->[2], $r->[6], '', $r->[0]);
+ if ($self->{inrbnfilter}) {
+ my ($want, undef) = $self->{inrbnfilter}->it($s);
+ next unless $want;
+ }
+ $r->[9] = \@s;
+
+ push @$spot, $r;
+
+ # At this point we run the queue to see if anything can be sent onwards to the punter
+ my $now = clock_gettime(CLOCK_REALTIME);
+
+ # now run the waiting queue which just contains KEYS ($call|$qrg)
+ foreach $sp (@{$self->{queue}}) {
+ my $cand = $spots->{$sp};
+ unless ($cand && $cand->[0]) {
+ dbg "RBN Cand " . ($cand ? 'def' : 'undef') . " [0] " . ($cand->[0] ? 'def' : 'undef') . " dwell $dwelltime";
+ next;
+ }
+ if ($now >= $cand->[0] + $dwelltime ) {
+ # we have a candidate, create qualitee value(s);
+ unless (@$cand > 1) {
+ dbg "RBN: QUEUE key '$sp' MISSING RECORDS " . dd($cand) if isdbg 'rbn';
+ shift @{$self->{queue}};
+ next;
+ }
+ my $savedtime = shift @$cand; # save the start time
+ my $r = $cand->[0];
+ my $quality = @$cand;
+ $quality = 9 if $quality > 9;
+ $quality = "Q:$quality";
+ if (isdbg('progress')) {
+ my $s = "RBN: SPOT key: '$sp' = $r->[2] on $r->[1] \@ $r->[5] $quality";
+ $s .= " route: $self->{call}";
+ dbg($s);
+ }
+
+ send_dx_spot($self, $quality, $cand);
+
+ # clear out the data and make this now just "spotted", but no further action required until respot time
+ dbg "RBN: QUEUE key '$sp' cleared" if isdbg 'rbn';
+
+ $spots->{$sp} = [$savedtime];
+ shift @{$self->{queue}};
+ } else {
+ dbg sprintf("RBN: QUEUE key: '$sp' SEND time not yet reached %.1f secs left", $spot->[0] + $dwelltime - $now) if isdbg 'rbnqueue';