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 @@ -63,12 +63,13 @@ sub index : Chained('root') PathPart('') Args(0) {
6363
6464 my @all_fav = map { $_ -> {fields }-> {distribution } }
6565 @{ $faves_data -> {hits }-> {hits } };
66- my $noLatest = $c -> model(' API::Release' )-> no_latest(@all_fav );
66+ my $noLatest = $c -> model(' API::Release' )-> no_latest(@all_fav )-> recv ;
67+ $took += $noLatest -> {took } || 0;
6768
6869 $faves = [
6970 map {
7071 my $distro = $_ -> {fields }-> {distribution };
71- $noLatest -> {$distro } ? () : $_ -> {fields };
72+ $noLatest -> {no_latest } -> { $distro } ? () : $_ -> {fields };
7273 } @{ $faves_data -> {hits }-> {hits } }
7374 ];
7475 $self -> single_valued_arrayref_to_scalar($faves );
Original file line number Diff line number Diff line change @@ -446,12 +446,13 @@ sub topuploaders {
446446
447447sub no_latest {
448448 my ( $self , @distributions ) = @_ ;
449+ my $cv = $self -> cv;
449450
450451 # If there are no distributions return
451452 return {} unless (@distributions );
452453
453454 @distributions = uniq @distributions ;
454- my $result = $self -> request(
455+ $self -> request(
455456 ' /release/_search' ,
456457 {
457458 size => scalar @distributions ,
@@ -468,17 +469,28 @@ sub no_latest {
468469 },
469470 fields => [qw( distribution status) ]
470471 }
471- )-> recv ;
472-
473- my @latest
474- = map { $_ -> {fields }-> {distribution } } @{ $result -> {hits }-> {hits } };
475-
476- my %no_latest = map {
477- my $distro = $_ ;
478- ( first { $_ eq $distro } @latest ) ? () : ( $distro , 1 );
479- } @distributions ;
480-
481- return \%no_latest ;
472+ )-> cb(
473+ sub {
474+ my $data = shift -> recv ;
475+ my @latest
476+ = map { $_ -> {fields }-> {distribution } }
477+ @{ $data -> {hits }-> {hits } };
478+ $cv -> send (
479+ {
480+ took => $data -> {took },
481+ no_latest => {
482+ map {
483+ my $distro = $_ ;
484+ ( first { $_ eq $distro } @latest )
485+ ? ()
486+ : ( $distro , 1 );
487+ } @distributions
488+ }
489+ }
490+ );
491+ }
492+ );
493+ return $cv ;
482494}
483495
484496__PACKAGE__ -> meta-> make_immutable;
You can’t perform that action at this time.
0 commit comments