20 |
sub take_action { |
sub take_action { |
21 |
my $self = shift; |
my $self = shift; |
22 |
|
|
23 |
|
my $q = $self->argument_value('content_contains') || warn "can't find content_contains"; |
24 |
|
|
25 |
$self->SUPER::take_action( @_ ); |
$self->SUPER::take_action( @_ ); |
26 |
|
|
27 |
my $coll = $self->result->content('search'); |
my $coll = $self->result->content('search'); |
29 |
Jifty->log->error('result not collection but ', dump( $coll )) |
Jifty->log->error('result not collection but ', dump( $coll )) |
30 |
unless ( $coll->isa('Jifty::Collection') ); |
unless ( $coll->isa('Jifty::Collection') ); |
31 |
|
|
32 |
if ($coll->count > 0) { |
my $results = $coll->count; |
|
$self->result->message( 'Found ' . $coll->count . ' results' ); |
|
|
|
|
|
warn "### about to fork!"; |
|
|
|
|
|
if (fork) { |
|
|
my $t = $coll->count; |
|
|
warn "### sleeping $t s..."; |
|
|
sleep $t; |
|
|
Grep::Event::Result->new({ coll => $coll, item_fragment => 'title' })->publish; |
|
|
exit 0; |
|
|
} |
|
33 |
|
|
34 |
|
if ($results > 0) { |
35 |
|
$self->result->message( "Found $results results" ); |
36 |
} else { |
} else { |
37 |
$self->result->error('No local results found, wait for remote results to arrive...'); |
$self->result->error('No local results found, wait for remote results to arrive...'); |
38 |
} |
} |