File tree Expand file tree Collapse file tree 2 files changed +27
-14
lines changed Expand file tree Collapse file tree 2 files changed +27
-14
lines changed Original file line number Diff line number Diff line change @@ -60,12 +60,13 @@ sub index : Chained('root') PathPart('') Args(0) {
6060
6161 my @all_fav = map { $_ -> {fields }-> {distribution } }
6262 @{ $faves_data -> {hits }-> {hits } };
63- my $noLatest = $c -> model(' API::Release' )-> no_latest(@all_fav );
63+ my $noLatest = $c -> model(' API::Release' )-> no_latest(@all_fav )-> recv ;
64+ $took += $noLatest -> {took } || 0;
6465
6566 $faves = [
6667 map {
6768 my $distro = $_ -> {fields }-> {distribution };
68- $noLatest -> {$distro } ? () : $_ -> {fields };
69+ $noLatest -> {no_latest } -> { $distro } ? () : $_ -> {fields };
6970 } @{ $faves_data -> {hits }-> {hits } }
7071 ];
7172 $self -> single_valued_arrayref_to_scalar($faves );
Original file line number Diff line number Diff line change @@ -445,12 +445,13 @@ sub topuploaders {
445445
446446sub no_latest {
447447 my ( $self , @distributions ) = @_ ;
448+ my $cv = $self -> cv;
448449
449450 # If there are no distributions return
450451 return {} unless (@distributions );
451452
452453 @distributions = uniq @distributions ;
453- my $result = $self -> request(
454+ $self -> request(
454455 ' /release/_search' ,
455456 {
456457 size => scalar @distributions ,
@@ -467,17 +468,28 @@ sub no_latest {
467468 },
468469 fields => [qw( distribution status) ]
469470 }
470- )-> recv ;
471-
472- my @latest
473- = map { $_ -> {fields }-> {distribution } } @{ $result -> {hits }-> {hits } };
474-
475- my %no_latest = map {
476- my $distro = $_ ;
477- ( first { $_ eq $distro } @latest ) ? () : ( $distro , 1 );
478- } @distributions ;
479-
480- return \%no_latest ;
471+ )-> cb(
472+ sub {
473+ my $data = shift -> recv ;
474+ my @latest
475+ = map { $_ -> {fields }-> {distribution } }
476+ @{ $data -> {hits }-> {hits } };
477+ $cv -> send (
478+ {
479+ took => $data -> {took },
480+ no_latest => {
481+ map {
482+ my $distro = $_ ;
483+ ( first { $_ eq $distro } @latest )
484+ ? ()
485+ : ( $distro , 1 );
486+ } @distributions
487+ }
488+ }
489+ );
490+ }
491+ );
492+ return $cv ;
481493}
482494
483495__PACKAGE__ -> meta-> make_immutable;
You can’t perform that action at this time.
0 commit comments